Class: Intrinio::OptionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/intrinio-sdk/api/options_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OptionsApi

Returns a new instance of OptionsApi.



19
20
21
# File 'lib/intrinio-sdk/api/options_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/intrinio-sdk/api/options_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_options(symbol, opts = {}) ⇒ ApiResponseOptions

Options Returns the master list of option contracts for a given symbol.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :expiration (String)

    The expiration date of the option contract. This will return options contracts with expiration dates on this date.

  • :expiration_after (String)

    The expiration date of the option contract. This will return options contracts with expiration dates after this date.

  • :expiration_before (String)

    The expiration date of the option contract. This will return options contracts with expiration dates before this date.

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



37
38
39
40
# File 'lib/intrinio-sdk/api/options_api.rb', line 37

def get_options(symbol, opts = {})
  data, _status_code, _headers = get_options_with_http_info(symbol, opts)
  return data
end

#get_options_chain(symbol, expiration, opts = {}) ⇒ ApiResponseOptionsChain

Options Chain Returns all options contracts and their prices for the given symbol and expiration date.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • expiration

    The expiration date of the options contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date of the option price. Returns option prices on this date.

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :moneyness (String)

    The moneyness of the options contracts to return. 'all' will return all options contracts. 'in_the_money' will return options contracts that are in the money (call options with strike prices below the current price, put options with strike prices above the current price). 'out_of_they_money' will return options contracts that are out of the money (call options with strike prices above the current price, put options with strike prices below the current price). 'near_the_money' will return options contracts that are $0.50 or less away from being in the money.

  • :page_size (Integer)

    The number of results to return (default to 100)

Returns:



123
124
125
126
# File 'lib/intrinio-sdk/api/options_api.rb', line 123

def get_options_chain(symbol, expiration, opts = {})
  data, _status_code, _headers = get_options_chain_with_http_info(symbol, expiration, opts)
  return data
end

#get_options_chain_realtime(symbol, expiration, opts = {}) ⇒ ApiResponseOptionsChainRealtime

Options Chain Realtime Returns all realtime options contracts and their prices for the given symbol and expiration date.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • expiration

    The expiration date of the options contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :volume_greater_than (Float)

    The volume of the option contract. This will return options contracts with volumes greater than this amount.

  • :volume_less_than (Float)

    The volume of the option contract. This will return options contracts with volumes less than this amout.

  • :open_interest_greater_than (Float)

    The open interest of the option contract. This will return options contracts with open interest greater than this amount.

  • :open_interest_less_than (Float)

    The open interest of the option contract. This will return options contracts with open interest less than this amount.

  • :moneyness (String)

    The moneyness of the options contracts to return. 'all' will return all options contracts. 'in_the_money' will return options contracts that are in the money (call options with strike prices below the current price, put options with strike prices above the current price). 'out_of_they_money' will return options contracts that are out of the money (call options with strike prices above the current price, put options with strike prices below the current price). 'near_the_money' will return options contracts that are $0.50 or less away from being in the money. Requires subscription to realtime stock price data.

Returns:



216
217
218
219
# File 'lib/intrinio-sdk/api/options_api.rb', line 216

def get_options_chain_realtime(symbol, expiration, opts = {})
  data, _status_code, _headers = get_options_chain_realtime_with_http_info(symbol, expiration, opts)
  return data
end

#get_options_chain_realtime_with_http_info(symbol, expiration, opts = {}) ⇒ Array<(ApiResponseOptionsChainRealtime, Fixnum, Hash)>

Options Chain Realtime Returns all realtime options contracts and their prices for the given symbol and expiration date.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • expiration

    The expiration date of the options contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :volume_greater_than (Float)

    The volume of the option contract. This will return options contracts with volumes greater than this amount.

  • :volume_less_than (Float)

    The volume of the option contract. This will return options contracts with volumes less than this amout.

  • :open_interest_greater_than (Float)

    The open interest of the option contract. This will return options contracts with open interest greater than this amount.

  • :open_interest_less_than (Float)

    The open interest of the option contract. This will return options contracts with open interest less than this amount.

  • :moneyness (String)

    The moneyness of the options contracts to return. &#39;all&#39; will return all options contracts. &#39;in_the_money&#39; will return options contracts that are in the money (call options with strike prices below the current price, put options with strike prices above the current price). &#39;out_of_they_money&#39; will return options contracts that are out of the money (call options with strike prices above the current price, put options with strike prices below the current price). &#39;near_the_money&#39; will return options contracts that are $0.50 or less away from being in the money. Requires subscription to realtime stock price data.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/intrinio-sdk/api/options_api.rb', line 237

def get_options_chain_realtime_with_http_info(symbol, expiration, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_chain_realtime ..."
  end
  # verify the required parameter 'symbol' is set
  if @api_client.config.client_side_validation && symbol.nil?
    fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_chain_realtime"
  end
  # verify the required parameter 'expiration' is set
  if @api_client.config.client_side_validation && expiration.nil?
    fail ArgumentError, "Missing the required parameter 'expiration' when calling OptionsApi.get_options_chain_realtime"
  end
  if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'delayed'].include?(opts[:'source'])
    fail ArgumentError, 'invalid value for "source", must be one of realtime, delayed'
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['call', 'put'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of call, put'
  end
  if @api_client.config.client_side_validation && opts[:'moneyness'] && !['all', 'in_the_money', 'out_of_the_money', 'near_the_money'].include?(opts[:'moneyness'])
    fail ArgumentError, 'invalid value for "moneyness", must be one of all, in_the_money, out_of_the_money, near_the_money'
  end
  # resource path
  local_var_path = "/options/chain/{symbol}/{expiration}/realtime".sub('{' + 'symbol' + '}', symbol.to_s).sub('{' + 'expiration' + '}', expiration.to_s)

  # query parameters
  query_params = {}
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'strike'] = opts[:'strike'] if !opts[:'strike'].nil?
  query_params[:'strike_greater_than'] = opts[:'strike_greater_than'] if !opts[:'strike_greater_than'].nil?
  query_params[:'strike_less_than'] = opts[:'strike_less_than'] if !opts[:'strike_less_than'].nil?
  query_params[:'volume_greater_than'] = opts[:'volume_greater_than'] if !opts[:'volume_greater_than'].nil?
  query_params[:'volume_less_than'] = opts[:'volume_less_than'] if !opts[:'volume_less_than'].nil?
  query_params[:'open_interest_greater_than'] = opts[:'open_interest_greater_than'] if !opts[:'open_interest_greater_than'].nil?
  query_params[:'open_interest_less_than'] = opts[:'open_interest_less_than'] if !opts[:'open_interest_less_than'].nil?
  query_params[:'moneyness'] = opts[:'moneyness'] if !opts[:'moneyness'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionsChainRealtime')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_chain_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_chain_with_http_info(symbol, expiration, opts = {}) ⇒ Array<(ApiResponseOptionsChain, Fixnum, Hash)>

Options Chain Returns all options contracts and their prices for the given symbol and expiration date.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • expiration

    The expiration date of the options contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date of the option price. Returns option prices on this date.

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :moneyness (String)

    The moneyness of the options contracts to return. &#39;all&#39; will return all options contracts. &#39;in_the_money&#39; will return options contracts that are in the money (call options with strike prices below the current price, put options with strike prices above the current price). &#39;out_of_they_money&#39; will return options contracts that are out of the money (call options with strike prices above the current price, put options with strike prices below the current price). &#39;near_the_money&#39; will return options contracts that are $0.50 or less away from being in the money.

  • :page_size (Integer)

    The number of results to return

Returns:

  • (Array<(ApiResponseOptionsChain, Fixnum, Hash)>)

    ApiResponseOptionsChain data, response status code and response headers



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/intrinio-sdk/api/options_api.rb', line 141

def get_options_chain_with_http_info(symbol, expiration, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_chain ..."
  end
  # verify the required parameter 'symbol' is set
  if @api_client.config.client_side_validation && symbol.nil?
    fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_chain"
  end
  # verify the required parameter 'expiration' is set
  if @api_client.config.client_side_validation && expiration.nil?
    fail ArgumentError, "Missing the required parameter 'expiration' when calling OptionsApi.get_options_chain"
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['call', 'put'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of call, put'
  end
  if @api_client.config.client_side_validation && opts[:'moneyness'] && !['all', 'in_the_money', 'out_of_the_money', 'near_the_money'].include?(opts[:'moneyness'])
    fail ArgumentError, 'invalid value for "moneyness", must be one of all, in_the_money, out_of_the_money, near_the_money'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options_chain, must be smaller than or equal to 10000.'
  end

  # resource path
  local_var_path = "/options/chain/{symbol}/{expiration}".sub('{' + 'symbol' + '}', symbol.to_s).sub('{' + 'expiration' + '}', expiration.to_s)

  # query parameters
  query_params = {}
  query_params[:'date'] = opts[:'date'] if !opts[:'date'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'strike'] = opts[:'strike'] if !opts[:'strike'].nil?
  query_params[:'strike_greater_than'] = opts[:'strike_greater_than'] if !opts[:'strike_greater_than'].nil?
  query_params[:'strike_less_than'] = opts[:'strike_less_than'] if !opts[:'strike_less_than'].nil?
  query_params[:'moneyness'] = opts[:'moneyness'] if !opts[:'moneyness'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionsChain')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_chain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_expirations(symbol, opts = {}) ⇒ ApiResponseOptionsExpirations

Options Expirations Returns all option contract expiration dates for a given symbol.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :after (String)

    Return option contract expiration dates after this date.

  • :before (String)

    Return option contract expiration dates before this date.

Returns:



305
306
307
308
# File 'lib/intrinio-sdk/api/options_api.rb', line 305

def get_options_expirations(symbol, opts = {})
  data, _status_code, _headers = get_options_expirations_with_http_info(symbol, opts)
  return data
end

#get_options_expirations_with_http_info(symbol, opts = {}) ⇒ Array<(ApiResponseOptionsExpirations, Fixnum, Hash)>

Options Expirations Returns all option contract expiration dates for a given symbol.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :after (String)

    Return option contract expiration dates after this date.

  • :before (String)

    Return option contract expiration dates before this date.

Returns:



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/intrinio-sdk/api/options_api.rb', line 317

def get_options_expirations_with_http_info(symbol, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_expirations ..."
  end
  # verify the required parameter 'symbol' is set
  if @api_client.config.client_side_validation && symbol.nil?
    fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options_expirations"
  end
  # resource path
  local_var_path = "/options/expirations/{symbol}".sub('{' + 'symbol' + '}', symbol.to_s)

  # query parameters
  query_params = {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionsExpirations')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_expirations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_prices(identifier, opts = {}) ⇒ ApiResponseOptionPrices

Option Prices Returns all option prices for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Return option contract prices on or after this date.

  • :end_date (String)

    Return option contract prices on or before this date.

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



366
367
368
369
# File 'lib/intrinio-sdk/api/options_api.rb', line 366

def get_options_prices(identifier, opts = {})
  data, _status_code, _headers = get_options_prices_with_http_info(identifier, opts)
  return data
end

#get_options_prices_realtime(identifier, opts = {}) ⇒ ApiResponseOptionsPriceRealtime

Option Prices Realtime Returns all option prices for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



432
433
434
435
# File 'lib/intrinio-sdk/api/options_api.rb', line 432

def get_options_prices_realtime(identifier, opts = {})
  data, _status_code, _headers = get_options_prices_realtime_with_http_info(identifier, opts)
  return data
end

#get_options_prices_realtime_with_http_info(identifier, opts = {}) ⇒ Array<(ApiResponseOptionsPriceRealtime, Fixnum, Hash)>

Option Prices Realtime Returns all option prices for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/intrinio-sdk/api/options_api.rb', line 443

def get_options_prices_realtime_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices_realtime ..."
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling OptionsApi.get_options_prices_realtime"
  end
  if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'delayed'].include?(opts[:'source'])
    fail ArgumentError, 'invalid value for "source", must be one of realtime, delayed'
  end
  # resource path
  local_var_path = "/options/prices/{identifier}/realtime".sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionsPriceRealtime')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_prices_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_prices_with_http_info(identifier, opts = {}) ⇒ Array<(ApiResponseOptionPrices, Fixnum, Hash)>

Option Prices Returns all option prices for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Return option contract prices on or after this date.

  • :end_date (String)

    Return option contract prices on or before this date.

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:

  • (Array<(ApiResponseOptionPrices, Fixnum, Hash)>)

    ApiResponseOptionPrices data, response status code and response headers



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/intrinio-sdk/api/options_api.rb', line 380

def get_options_prices_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices ..."
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling OptionsApi.get_options_prices"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options_prices, must be smaller than or equal to 10000.'
  end

  # resource path
  local_var_path = "/options/prices/{identifier}".sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionPrices')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_prices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_stats_realtime(identifier, opts = {}) ⇒ ApiResponseOptionsStatsRealtime

Option Stats Realtime Returns all option stats (greeks and implied volatility) and factors used to calculate them, for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



491
492
493
494
# File 'lib/intrinio-sdk/api/options_api.rb', line 491

def get_options_stats_realtime(identifier, opts = {})
  data, _status_code, _headers = get_options_stats_realtime_with_http_info(identifier, opts)
  return data
end

#get_options_stats_realtime_with_http_info(identifier, opts = {}) ⇒ Array<(ApiResponseOptionsStatsRealtime, Fixnum, Hash)>

Option Stats Realtime Returns all option stats (greeks and implied volatility) and factors used to calculate them, for a given option contract identifier.

Parameters:

  • identifier

    The Intrinio ID or code of the options contract to request prices for.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/intrinio-sdk/api/options_api.rb', line 502

def get_options_stats_realtime_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_stats_realtime ..."
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling OptionsApi.get_options_stats_realtime"
  end
  if @api_client.config.client_side_validation && opts[:'source'] && !['realtime', 'delayed'].include?(opts[:'source'])
    fail ArgumentError, 'invalid value for "source", must be one of realtime, delayed'
  end
  # resource path
  local_var_path = "/options/prices/{identifier}/realtime/stats".sub('{' + 'identifier' + '}', identifier.to_s)

  # query parameters
  query_params = {}
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptionsStatsRealtime')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_stats_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_options_with_http_info(symbol, opts = {}) ⇒ Array<(ApiResponseOptions, Fixnum, Hash)>

Options Returns the master list of option contracts for a given symbol.

Parameters:

  • symbol

    The option symbol, corresponding to the underlying security.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :type (String)

    The option contract type.

  • :strike (Float)

    The strike price of the option contract. This will return options contracts with strike price equal to this price.

  • :strike_greater_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices greater than this price.

  • :strike_less_than (Float)

    The strike price of the option contract. This will return options contracts with strike prices less than this price.

  • :expiration (String)

    The expiration date of the option contract. This will return options contracts with expiration dates on this date.

  • :expiration_after (String)

    The expiration date of the option contract. This will return options contracts with expiration dates after this date.

  • :expiration_before (String)

    The expiration date of the option contract. This will return options contracts with expiration dates before this date.

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:

  • (Array<(ApiResponseOptions, Fixnum, Hash)>)

    ApiResponseOptions data, response status code and response headers



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/intrinio-sdk/api/options_api.rb', line 56

def get_options_with_http_info(symbol, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options ..."
  end
  # verify the required parameter 'symbol' is set
  if @api_client.config.client_side_validation && symbol.nil?
    fail ArgumentError, "Missing the required parameter 'symbol' when calling OptionsApi.get_options"
  end
  if @api_client.config.client_side_validation && opts[:'type'] && !['call', 'put'].include?(opts[:'type'])
    fail ArgumentError, 'invalid value for "type", must be one of call, put'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options, must be smaller than or equal to 10000.'
  end

  # resource path
  local_var_path = "/options/{symbol}".sub('{' + 'symbol' + '}', symbol.to_s)

  # query parameters
  query_params = {}
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'strike'] = opts[:'strike'] if !opts[:'strike'].nil?
  query_params[:'strike_greater_than'] = opts[:'strike_greater_than'] if !opts[:'strike_greater_than'].nil?
  query_params[:'strike_less_than'] = opts[:'strike_less_than'] if !opts[:'strike_less_than'].nil?
  query_params[:'expiration'] = opts[:'expiration'] if !opts[:'expiration'].nil?
  query_params[:'expiration_after'] = opts[:'expiration_after'] if !opts[:'expiration_after'].nil?
  query_params[:'expiration_before'] = opts[:'expiration_before'] if !opts[:'expiration_before'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ApiResponseOptions')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end