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_option_expirations_realtime(symbol, opts = {}) ⇒ ApiResponseOptionsExpirations

Option Expirations Realtime Returns all realtime 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.

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



31
32
33
34
# File 'lib/intrinio-sdk/api/options_api.rb', line 31

def get_option_expirations_realtime(symbol, opts = {})
  data, _status_code, _headers = get_option_expirations_realtime_with_http_info(symbol, opts)
  return data
end

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

Option Expirations Realtime Returns all realtime 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.

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
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
# File 'lib/intrinio-sdk/api/options_api.rb', line 44

def get_option_expirations_realtime_with_http_info(symbol, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_option_expirations_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_option_expirations_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/expirations/{symbol}/realtime".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?
  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 => 'ApiResponseOptionsExpirations')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_option_expirations_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#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:



102
103
104
105
# File 'lib/intrinio-sdk/api/options_api.rb', line 102

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

#get_options_by_symbol_realtime(symbol, opts = {}) ⇒ ApiResponseOptionsRealtime

Options by Symbol Realtime Returns the master list of realtime 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.

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:



188
189
190
191
# File 'lib/intrinio-sdk/api/options_api.rb', line 188

def get_options_by_symbol_realtime(symbol, opts = {})
  data, _status_code, _headers = get_options_by_symbol_realtime_with_http_info(symbol, opts)
  return data
end

#get_options_by_symbol_realtime_with_http_info(symbol, opts = {}) ⇒ Array<(ApiResponseOptionsRealtime, Fixnum, Hash)>

Options by Symbol Realtime Returns the master list of realtime 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.

  • :source (String)

    Realtime or 15-minute delayed contracts.

Returns:

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

    ApiResponseOptionsRealtime data, response status code and response headers



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/intrinio-sdk/api/options_api.rb', line 206

def get_options_by_symbol_realtime_with_http_info(symbol, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: OptionsApi.get_options_by_symbol_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_by_symbol_realtime"
  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[:'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/{symbol}/realtime".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[:'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 => 'ApiResponseOptionsRealtime')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OptionsApi#get_options_by_symbol_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
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. &#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 (default to 100)

Returns:



271
272
273
274
# File 'lib/intrinio-sdk/api/options_api.rb', line 271

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. &#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:



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

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:



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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/intrinio-sdk/api/options_api.rb', line 385

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



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
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
# File 'lib/intrinio-sdk/api/options_api.rb', line 289

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:



453
454
455
456
# File 'lib/intrinio-sdk/api/options_api.rb', line 453

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:



465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/intrinio-sdk/api/options_api.rb', line 465

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:



514
515
516
517
# File 'lib/intrinio-sdk/api/options_api.rb', line 514

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:



580
581
582
583
# File 'lib/intrinio-sdk/api/options_api.rb', line 580

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:



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
# File 'lib/intrinio-sdk/api/options_api.rb', line 591

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



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/intrinio-sdk/api/options_api.rb', line 528

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:



639
640
641
642
# File 'lib/intrinio-sdk/api/options_api.rb', line 639

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:



650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
# File 'lib/intrinio-sdk/api/options_api.rb', line 650

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



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
# File 'lib/intrinio-sdk/api/options_api.rb', line 121

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