=begin #Intrinio API #Welcome to the Intrinio API! Through our Financial Data Marketplace, we offer a wide selection of financial data feed APIs sourced by our own proprietary processes as well as from many data vendors. For a complete API request / response reference please view the [Intrinio API documentation](https://docs.intrinio.com/documentation/api_v2). If you need additional help in using the API, please visit the [Intrinio website](https://intrinio.com) and click on the chat icon in the lower right corner. OpenAPI spec version: 2.75.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: unset =end require "uri" module Intrinio class OptionsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Options Tickers # Returns all tickers that have existing options contracts. # @param [Hash] opts the optional parameters # @return [ApiResponseOptionsTickers] def get_all_options_tickers(opts = {}) data, _status_code, _headers = get_all_options_tickers_with_http_info(opts) return data end # Options Tickers # Returns all tickers that have existing options contracts. # @param [Hash] opts the optional parameters # @return [Array<(ApiResponseOptionsTickers, Fixnum, Hash)>] ApiResponseOptionsTickers data, response status code and response headers def get_all_options_tickers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_all_options_tickers ..." end # resource path local_var_path = "/options/tickers" # query parameters query_params = {} # 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 => 'ApiResponseOptionsTickers') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_all_options_tickers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Total open interest and volume aggregated by ticker # Returns total open interest and volume by ticker # @param [Hash] opts the optional parameters # @option opts [Object] :date Return aggregated data for this date # @option opts [Integer] :page_size The number of results to return (default to 100) # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [ApiResponseOptionsAggregates] def get_option_aggregates(opts = {}) data, _status_code, _headers = get_option_aggregates_with_http_info(opts) return data end # Total open interest and volume aggregated by ticker # Returns total open interest and volume by ticker # @param [Hash] opts the optional parameters # @option opts [Object] :date Return aggregated data for this date # @option opts [Integer] :page_size The number of results to return # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(ApiResponseOptionsAggregates, Fixnum, Hash)>] ApiResponseOptionsAggregates data, response status code and response headers def get_option_aggregates_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_option_aggregates ..." end # resource path local_var_path = "/options/aggregates" # query parameters query_params = {} query_params[:'date'] = opts[:'date'] if !opts[:'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 => 'ApiResponseOptionsAggregates') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_option_aggregates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsExpirations] def get_option_expirations_realtime(symbol, opts = {}) data, _status_code, _headers = get_option_expirations_realtime_with_http_info(symbol, opts) return data end # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsExpirations, Fixnum, Hash)>] ApiResponseOptionsExpirations data, response status code and response headers 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? query_params[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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 # Option Strikes Realtime # Returns a list of the latest top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all call/put contracts that match the strike and symbol specified. # @param symbol The option symbol, corresponding to the underlying security. # @param strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or delayed. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsChainRealtime] def get_option_strikes_realtime(symbol, strike, opts = {}) data, _status_code, _headers = get_option_strikes_realtime_with_http_info(symbol, strike, opts) return data end # Option Strikes Realtime # Returns a list of the latest top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all call/put contracts that match the strike and symbol specified. # @param symbol The option symbol, corresponding to the underlying security. # @param strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or delayed. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsChainRealtime, Fixnum, Hash)>] ApiResponseOptionsChainRealtime data, response status code and response headers def get_option_strikes_realtime_with_http_info(symbol, strike, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_option_strikes_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_strikes_realtime" end # verify the required parameter 'strike' is set if @api_client.config.client_side_validation && strike.nil? fail ArgumentError, "Missing the required parameter 'strike' when calling OptionsApi.get_option_strikes_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[:'stock_price_source'] && !['iex', 'bats_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip', 'utp_delayed', 'otc_delayed', 'cta_a_delayed', 'cta_b_delayed', 'nasdaq_basic'].include?(opts[:'stock_price_source']) fail ArgumentError, 'invalid value for "stock_price_source", must be one of iex, bats_delayed, intrinio_mx, intrinio_mx_plus, delayed_sip, utp_delayed, otc_delayed, cta_a_delayed, cta_b_delayed, nasdaq_basic' end if @api_client.config.client_side_validation && opts[:'model'] && !['black_scholes', 'bjerk'].include?(opts[:'model']) fail ArgumentError, 'invalid value for "model", must be one of black_scholes, bjerk' end # resource path local_var_path = "/options/strikes/{symbol}/{strike}/realtime".sub('{' + 'symbol' + '}', symbol.to_s).sub('{' + 'strike' + '}', strike.to_s) # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'stock_price_source'] = opts[:'stock_price_source'] if !opts[:'stock_price_source'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].nil? query_params[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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_option_strikes_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Trades # Returns all trades between start time and end time, up to seven days ago for the specified source. # @param [Hash] opts the optional parameters # @option opts [String] :source The specific source of the data being requested. # @option opts [Date] :start_date The start date for the data being requested. # @option opts [String] :start_time The start time for the data being requested. # @option opts [Date] :end_date The end date for the data being requested. # @option opts [String] :end_time The end time for the data being requested. # @option opts [String] :timezone The timezone the start and end date/times use. (default to UTC) # @option opts [Integer] :page_size The maximum number of results to return per page. (default to 100) # @option opts [Integer] :min_size Trades must be larger or equal to this size. # @option opts [String] :security The ticker symbol for which trades are being requested. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [OptionTradesResult] def get_option_trades(opts = {}) data, _status_code, _headers = get_option_trades_with_http_info(opts) return data end # Option Trades # Returns all trades between start time and end time, up to seven days ago for the specified source. # @param [Hash] opts the optional parameters # @option opts [String] :source The specific source of the data being requested. # @option opts [Date] :start_date The start date for the data being requested. # @option opts [String] :start_time The start time for the data being requested. # @option opts [Date] :end_date The end date for the data being requested. # @option opts [String] :end_time The end time for the data being requested. # @option opts [String] :timezone The timezone the start and end date/times use. # @option opts [Integer] :page_size The maximum number of results to return per page. # @option opts [Integer] :min_size Trades must be larger or equal to this size. # @option opts [String] :security The ticker symbol for which trades are being requested. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(OptionTradesResult, Fixnum, Hash)>] OptionTradesResult data, response status code and response headers def get_option_trades_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_option_trades ..." 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[:'timezone'] && !['Africa/Algiers', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Monrovia', 'Africa/Nairobi', 'America/Argentina/Buenos_Aires', 'America/Bogota', 'America/Caracas', 'America/Chicago', 'America/Chihuahua', 'America/Denver', 'America/Godthab', 'America/Guatemala', 'America/Guyana', 'America/Halifax', 'America/Indiana/Indianapolis', 'America/Juneau', 'America/La_Paz', 'America/Lima', 'America/Lima', 'America/Los_Angeles', 'America/Mazatlan', 'America/Mexico_City', 'America/Mexico_City', 'America/Monterrey', 'America/Montevideo', 'America/New_York', 'America/Phoenix', 'America/Regina', 'America/Santiago', 'America/Sao_Paulo', 'America/St_Johns', 'America/Tijuana', 'Asia/Almaty', 'Asia/Baghdad', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Bangkok', 'Asia/Chongqing', 'Asia/Colombo', 'Asia/Dhaka', 'Asia/Dhaka', 'Asia/Hong_Kong', 'Asia/Irkutsk', 'Asia/Jakarta', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Karachi', 'Asia/Kathmandu', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuwait', 'Asia/Magadan', 'Asia/Muscat', 'Asia/Muscat', 'Asia/Novosibirsk', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Ulaanbaatar', 'Asia/Urumqi', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Cape_Verde', 'Atlantic/South_Georgia', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Darwin', 'Australia/Hobart', 'Australia/Melbourne', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney', 'Etc/UTC', 'UTC', 'Europe/Amsterdam', 'Europe/Athens', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Helsinki', 'Europe/Istanbul', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/London', 'Europe/Madrid', 'Europe/Minsk', 'Europe/Moscow', 'Europe/Moscow', 'Europe/Paris', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/Sarajevo', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Majuro', 'Pacific/Midway', 'Pacific/Midway', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Port_Moresby', 'Pacific/Tongatapu'].include?(opts[:'timezone']) fail ArgumentError, 'invalid value for "timezone", must be one of Africa/Algiers, Africa/Cairo, Africa/Casablanca, Africa/Harare, Africa/Johannesburg, Africa/Monrovia, Africa/Nairobi, America/Argentina/Buenos_Aires, America/Bogota, America/Caracas, America/Chicago, America/Chihuahua, America/Denver, America/Godthab, America/Guatemala, America/Guyana, America/Halifax, America/Indiana/Indianapolis, America/Juneau, America/La_Paz, America/Lima, America/Lima, America/Los_Angeles, America/Mazatlan, America/Mexico_City, America/Mexico_City, America/Monterrey, America/Montevideo, America/New_York, America/Phoenix, America/Regina, America/Santiago, America/Sao_Paulo, America/St_Johns, America/Tijuana, Asia/Almaty, Asia/Baghdad, Asia/Baku, Asia/Bangkok, Asia/Bangkok, Asia/Chongqing, Asia/Colombo, Asia/Dhaka, Asia/Dhaka, Asia/Hong_Kong, Asia/Irkutsk, Asia/Jakarta, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi, Asia/Karachi, Asia/Kathmandu, Asia/Kolkata, Asia/Kolkata, Asia/Kolkata, Asia/Kolkata, Asia/Krasnoyarsk, Asia/Kuala_Lumpur, Asia/Kuwait, Asia/Magadan, Asia/Muscat, Asia/Muscat, Asia/Novosibirsk, Asia/Rangoon, Asia/Riyadh, Asia/Seoul, Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran, Asia/Tokyo, Asia/Tokyo, Asia/Tokyo, Asia/Ulaanbaatar, Asia/Urumqi, Asia/Vladivostok, Asia/Yakutsk, Asia/Yekaterinburg, Asia/Yerevan, Atlantic/Azores, Atlantic/Cape_Verde, Atlantic/South_Georgia, Australia/Adelaide, Australia/Brisbane, Australia/Darwin, Australia/Hobart, Australia/Melbourne, Australia/Melbourne, Australia/Perth, Australia/Sydney, Etc/UTC, UTC, Europe/Amsterdam, Europe/Athens, Europe/Belgrade, Europe/Berlin, Europe/Berlin, Europe/Bratislava, Europe/Brussels, Europe/Bucharest, Europe/Budapest, Europe/Copenhagen, Europe/Dublin, Europe/Helsinki, Europe/Istanbul, Europe/Kaliningrad, Europe/Kiev, Europe/Lisbon, Europe/Ljubljana, Europe/London, Europe/London, Europe/Madrid, Europe/Minsk, Europe/Moscow, Europe/Moscow, Europe/Paris, Europe/Prague, Europe/Riga, Europe/Rome, Europe/Samara, Europe/Sarajevo, Europe/Skopje, Europe/Sofia, Europe/Stockholm, Europe/Tallinn, Europe/Vienna, Europe/Vilnius, Europe/Volgograd, Europe/Warsaw, Europe/Zagreb, Pacific/Apia, Pacific/Auckland, Pacific/Auckland, Pacific/Chatham, Pacific/Fakaofo, Pacific/Fiji, Pacific/Guadalcanal, Pacific/Guam, Pacific/Honolulu, Pacific/Majuro, Pacific/Midway, Pacific/Midway, Pacific/Noumea, Pacific/Pago_Pago, Pacific/Port_Moresby, Pacific/Tongatapu' 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_option_trades, must be smaller than or equal to 10000.' end # resource path local_var_path = "/options/trades" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? query_params[:'timezone'] = opts[:'timezone'] if !opts[:'timezone'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'min_size'] = opts[:'min_size'] if !opts[:'min_size'].nil? query_params[:'security'] = opts[:'security'] if !opts[:'security'].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 => 'OptionTradesResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_option_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Trades By Contract # Returns all trades for a contract between start time and end time, up to seven days ago for the specified source. # @param identifier The option contract for which trades are being requested. # @param [Hash] opts the optional parameters # @option opts [String] :source The specific source of the data being requested. # @option opts [Date] :start_date The start date for the data being requested. # @option opts [String] :start_time The start time for the data being requested. # @option opts [Date] :end_date The end date for the data being requested. # @option opts [String] :end_time The end time for the data being requested. # @option opts [String] :timezone The timezone the start and end date/times use. (default to UTC) # @option opts [Integer] :page_size The maximum number of results to return per page. (default to 100) # @option opts [Integer] :min_size Trades must be larger or equal to this size. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [OptionTradesResult] def get_option_trades_by_contract(identifier, opts = {}) data, _status_code, _headers = get_option_trades_by_contract_with_http_info(identifier, opts) return data end # Option Trades By Contract # Returns all trades for a contract between start time and end time, up to seven days ago for the specified source. # @param identifier The option contract for which trades are being requested. # @param [Hash] opts the optional parameters # @option opts [String] :source The specific source of the data being requested. # @option opts [Date] :start_date The start date for the data being requested. # @option opts [String] :start_time The start time for the data being requested. # @option opts [Date] :end_date The end date for the data being requested. # @option opts [String] :end_time The end time for the data being requested. # @option opts [String] :timezone The timezone the start and end date/times use. # @option opts [Integer] :page_size The maximum number of results to return per page. # @option opts [Integer] :min_size Trades must be larger or equal to this size. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(OptionTradesResult, Fixnum, Hash)>] OptionTradesResult data, response status code and response headers def get_option_trades_by_contract_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_option_trades_by_contract ..." 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_option_trades_by_contract" 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[:'timezone'] && !['Africa/Algiers', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Monrovia', 'Africa/Nairobi', 'America/Argentina/Buenos_Aires', 'America/Bogota', 'America/Caracas', 'America/Chicago', 'America/Chihuahua', 'America/Denver', 'America/Godthab', 'America/Guatemala', 'America/Guyana', 'America/Halifax', 'America/Indiana/Indianapolis', 'America/Juneau', 'America/La_Paz', 'America/Lima', 'America/Lima', 'America/Los_Angeles', 'America/Mazatlan', 'America/Mexico_City', 'America/Mexico_City', 'America/Monterrey', 'America/Montevideo', 'America/New_York', 'America/Phoenix', 'America/Regina', 'America/Santiago', 'America/Sao_Paulo', 'America/St_Johns', 'America/Tijuana', 'Asia/Almaty', 'Asia/Baghdad', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Bangkok', 'Asia/Chongqing', 'Asia/Colombo', 'Asia/Dhaka', 'Asia/Dhaka', 'Asia/Hong_Kong', 'Asia/Irkutsk', 'Asia/Jakarta', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Karachi', 'Asia/Kathmandu', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuwait', 'Asia/Magadan', 'Asia/Muscat', 'Asia/Muscat', 'Asia/Novosibirsk', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Ulaanbaatar', 'Asia/Urumqi', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Cape_Verde', 'Atlantic/South_Georgia', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Darwin', 'Australia/Hobart', 'Australia/Melbourne', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney', 'Etc/UTC', 'UTC', 'Europe/Amsterdam', 'Europe/Athens', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Helsinki', 'Europe/Istanbul', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/London', 'Europe/Madrid', 'Europe/Minsk', 'Europe/Moscow', 'Europe/Moscow', 'Europe/Paris', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/Sarajevo', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Majuro', 'Pacific/Midway', 'Pacific/Midway', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Port_Moresby', 'Pacific/Tongatapu'].include?(opts[:'timezone']) fail ArgumentError, 'invalid value for "timezone", must be one of Africa/Algiers, Africa/Cairo, Africa/Casablanca, Africa/Harare, Africa/Johannesburg, Africa/Monrovia, Africa/Nairobi, America/Argentina/Buenos_Aires, America/Bogota, America/Caracas, America/Chicago, America/Chihuahua, America/Denver, America/Godthab, America/Guatemala, America/Guyana, America/Halifax, America/Indiana/Indianapolis, America/Juneau, America/La_Paz, America/Lima, America/Lima, America/Los_Angeles, America/Mazatlan, America/Mexico_City, America/Mexico_City, America/Monterrey, America/Montevideo, America/New_York, America/Phoenix, America/Regina, America/Santiago, America/Sao_Paulo, America/St_Johns, America/Tijuana, Asia/Almaty, Asia/Baghdad, Asia/Baku, Asia/Bangkok, Asia/Bangkok, Asia/Chongqing, Asia/Colombo, Asia/Dhaka, Asia/Dhaka, Asia/Hong_Kong, Asia/Irkutsk, Asia/Jakarta, Asia/Jerusalem, Asia/Kabul, Asia/Kamchatka, Asia/Karachi, Asia/Karachi, Asia/Kathmandu, Asia/Kolkata, Asia/Kolkata, Asia/Kolkata, Asia/Kolkata, Asia/Krasnoyarsk, Asia/Kuala_Lumpur, Asia/Kuwait, Asia/Magadan, Asia/Muscat, Asia/Muscat, Asia/Novosibirsk, Asia/Rangoon, Asia/Riyadh, Asia/Seoul, Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei, Asia/Tashkent, Asia/Tbilisi, Asia/Tehran, Asia/Tokyo, Asia/Tokyo, Asia/Tokyo, Asia/Ulaanbaatar, Asia/Urumqi, Asia/Vladivostok, Asia/Yakutsk, Asia/Yekaterinburg, Asia/Yerevan, Atlantic/Azores, Atlantic/Cape_Verde, Atlantic/South_Georgia, Australia/Adelaide, Australia/Brisbane, Australia/Darwin, Australia/Hobart, Australia/Melbourne, Australia/Melbourne, Australia/Perth, Australia/Sydney, Etc/UTC, UTC, Europe/Amsterdam, Europe/Athens, Europe/Belgrade, Europe/Berlin, Europe/Berlin, Europe/Bratislava, Europe/Brussels, Europe/Bucharest, Europe/Budapest, Europe/Copenhagen, Europe/Dublin, Europe/Helsinki, Europe/Istanbul, Europe/Kaliningrad, Europe/Kiev, Europe/Lisbon, Europe/Ljubljana, Europe/London, Europe/London, Europe/Madrid, Europe/Minsk, Europe/Moscow, Europe/Moscow, Europe/Paris, Europe/Prague, Europe/Riga, Europe/Rome, Europe/Samara, Europe/Sarajevo, Europe/Skopje, Europe/Sofia, Europe/Stockholm, Europe/Tallinn, Europe/Vienna, Europe/Vilnius, Europe/Volgograd, Europe/Warsaw, Europe/Zagreb, Pacific/Apia, Pacific/Auckland, Pacific/Auckland, Pacific/Chatham, Pacific/Fakaofo, Pacific/Fiji, Pacific/Guadalcanal, Pacific/Guam, Pacific/Honolulu, Pacific/Majuro, Pacific/Midway, Pacific/Midway, Pacific/Noumea, Pacific/Pago_Pago, Pacific/Port_Moresby, Pacific/Tongatapu' 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_option_trades_by_contract, must be smaller than or equal to 10000.' end # resource path local_var_path = "/options/{identifier}/trades".sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? query_params[:'timezone'] = opts[:'timezone'] if !opts[:'timezone'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'min_size'] = opts[:'min_size'] if !opts[:'min_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 => 'OptionTradesResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_option_trades_by_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options # Returns a list of all securities that have options listed and are tradable on a US market exchange. Useful to retrieve the entire universe. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :expiration The expiration date of the option contract. This will return options contracts with expiration dates on this date. # @option opts [String] :expiration_after The expiration date of the option contract. This will return options contracts with expiration dates after this date. # @option opts [String] :expiration_before The expiration date of the option contract. This will return options contracts with expiration dates before this date. # @option opts [Integer] :page_size The number of results to return (default to 100) # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [ApiResponseOptions] def get_options(symbol, opts = {}) data, _status_code, _headers = get_options_with_http_info(symbol, opts) return data end # Options # Returns a list of all securities that have options listed and are tradable on a US market exchange. Useful to retrieve the entire universe. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :expiration The expiration date of the option contract. This will return options contracts with expiration dates on this date. # @option opts [String] :expiration_after The expiration date of the option contract. This will return options contracts with expiration dates after this date. # @option opts [String] :expiration_before The expiration date of the option contract. This will return options contracts with expiration dates before this date. # @option opts [Integer] :page_size The number of results to return # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(ApiResponseOptions, Fixnum, Hash)>] ApiResponseOptions data, response status code and response headers 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 # Options by Symbol Realtime # Returns a list of all securities that have options listed and are tradable on a US market exchange. Useful to retrieve the entire universe. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :expiration The expiration date of the option contract. This will return options contracts with expiration dates on this date. # @option opts [String] :expiration_after The expiration date of the option contract. This will return options contracts with expiration dates after this date. # @option opts [String] :expiration_before The expiration date of the option contract. This will return options contracts with expiration dates before this date. # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsRealtime] 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 # Options by Symbol Realtime # Returns a list of all securities that have options listed and are tradable on a US market exchange. Useful to retrieve the entire universe. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :expiration The expiration date of the option contract. This will return options contracts with expiration dates on this date. # @option opts [String] :expiration_after The expiration date of the option contract. This will return options contracts with expiration dates after this date. # @option opts [String] :expiration_before The expiration date of the option contract. This will return options contracts with expiration dates before this date. # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsRealtime, Fixnum, Hash)>] ApiResponseOptionsRealtime data, response status code and response headers 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? query_params[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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 # Options Chain # Returns a list of the historical end-of-day top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the option chain. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [Date] :date The date of the option price. Returns option prices on this date. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :moneyness 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. # @option opts [Integer] :page_size The number of results to return (default to 100) # @return [ApiResponseOptionsChain] def get_options_chain(symbol, expiration, opts = {}) data, _status_code, _headers = get_options_chain_with_http_info(symbol, expiration, opts) return data end # Options Chain # Returns a list of the historical end-of-day top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the option chain. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [Date] :date The date of the option price. Returns option prices on this date. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [String] :moneyness 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. # @option opts [Integer] :page_size The number of results to return # @return [Array<(ApiResponseOptionsChain, Fixnum, Hash)>] ApiResponseOptionsChain data, response status code and response headers 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 # Options Chain EOD # Returns all EOD options contracts and their prices for the given symbol and expiration date. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [Date] :date The date to retrieve prices for # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsChainEod] def get_options_chain_eod(symbol, expiration, opts = {}) data, _status_code, _headers = get_options_chain_eod_with_http_info(symbol, expiration, opts) return data end # Options Chain EOD # Returns all EOD options contracts and their prices for the given symbol and expiration date. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [Date] :date The date to retrieve prices for # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsChainEod, Fixnum, Hash)>] ApiResponseOptionsChainEod data, response status code and response headers def get_options_chain_eod_with_http_info(symbol, expiration, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_chain_eod ..." 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_eod" 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_eod" 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 # resource path local_var_path = "/options/chain/{symbol}/{expiration}/eod".sub('{' + 'symbol' + '}', symbol.to_s).sub('{' + 'expiration' + '}', expiration.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[:'date'] = opts[:'date'] if !opts[:'date'].nil? query_params[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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 => 'ApiResponseOptionsChainEod') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_chain_eod\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Chain Realtime # Returns a list of the latest National Best Bid & Offer (NBBO) top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the option chain. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [Float] :volume_greater_than The volume of the option contract. This will return options contracts with volumes greater than this amount. # @option opts [Float] :volume_less_than The volume of the option contract. This will return options contracts with volumes less than this amout. # @option opts [Float] :open_interest_greater_than The open interest of the option contract. This will return options contracts with open interest greater than this amount. # @option opts [Float] :open_interest_less_than The open interest of the option contract. This will return options contracts with open interest less than this amount. # @option opts [String] :moneyness 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. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsChainRealtime] 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 # Options Chain Realtime # Returns a list of the latest National Best Bid & Offer (NBBO) top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the option chain. # @param symbol The option symbol, corresponding to the underlying security. # @param expiration The expiration date of the options contract # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [Float] :volume_greater_than The volume of the option contract. This will return options contracts with volumes greater than this amount. # @option opts [Float] :volume_less_than The volume of the option contract. This will return options contracts with volumes less than this amout. # @option opts [Float] :open_interest_greater_than The open interest of the option contract. This will return options contracts with open interest greater than this amount. # @option opts [Float] :open_interest_less_than The open interest of the option contract. This will return options contracts with open interest less than this amount. # @option opts [String] :moneyness 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. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsChainRealtime, Fixnum, Hash)>] ApiResponseOptionsChainRealtime data, response status code and response headers 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 if @api_client.config.client_side_validation && opts[:'stock_price_source'] && !['iex', 'bats_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip', 'utp_delayed', 'otc_delayed', 'cta_a_delayed', 'cta_b_delayed', 'nasdaq_basic'].include?(opts[:'stock_price_source']) fail ArgumentError, 'invalid value for "stock_price_source", must be one of iex, bats_delayed, intrinio_mx, intrinio_mx_plus, delayed_sip, utp_delayed, otc_delayed, cta_a_delayed, cta_b_delayed, nasdaq_basic' end if @api_client.config.client_side_validation && opts[:'model'] && !['black_scholes', 'bjerk'].include?(opts[:'model']) fail ArgumentError, 'invalid value for "model", must be one of black_scholes, bjerk' 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? query_params[:'stock_price_source'] = opts[:'stock_price_source'] if !opts[:'stock_price_source'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].nil? query_params[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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 # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @return [ApiResponseOptionsExpirations] def get_options_expirations(symbol, opts = {}) data, _status_code, _headers = get_options_expirations_with_http_info(symbol, opts) return data end # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. Available via a 3rd party, contact sales for a trial. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @return [Array<(ApiResponseOptionsExpirations, Fixnum, Hash)>] ApiResponseOptionsExpirations data, response status code and response headers 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 # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [ApiResponseOptionsExpirations] def get_options_expirations_eod(symbol, opts = {}) data, _status_code, _headers = get_options_expirations_eod_with_http_info(symbol, opts) return data end # Options Expirations # Returns a list of all current and upcoming option contract expiration dates for a particular symbol. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :after Return option contract expiration dates after this date. # @option opts [String] :before Return option contract expiration dates before this date. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @return [Array<(ApiResponseOptionsExpirations, Fixnum, Hash)>] ApiResponseOptionsExpirations data, response status code and response headers def get_options_expirations_eod_with_http_info(symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_expirations_eod ..." 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_eod" end # resource path local_var_path = "/options/expirations/{symbol}/eod".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[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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_eod\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Intervals By Contract # Returns a list of interval data points for a contract. # @param identifier The Intrinio ID or code of the options contract to request intervals for. # @param interval_size The time length of the interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [Integer] :page_size The number of results to return (default to 100) # @option opts [DateTime] :end_time The inclusive UTC date and time the intervals end at. # @return [OptionIntervalsResult] def get_options_interval_by_contract(identifier, interval_size, opts = {}) data, _status_code, _headers = get_options_interval_by_contract_with_http_info(identifier, interval_size, opts) return data end # Options Intervals By Contract # Returns a list of interval data points for a contract. # @param identifier The Intrinio ID or code of the options contract to request intervals for. # @param interval_size The time length of the interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [Integer] :page_size The number of results to return # @option opts [DateTime] :end_time The inclusive UTC date and time the intervals end at. # @return [Array<(OptionIntervalsResult, Fixnum, Hash)>] OptionIntervalsResult data, response status code and response headers def get_options_interval_by_contract_with_http_info(identifier, interval_size, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_interval_by_contract ..." 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_interval_by_contract" end # verify the required parameter 'interval_size' is set if @api_client.config.client_side_validation && interval_size.nil? fail ArgumentError, "Missing the required parameter 'interval_size' when calling OptionsApi.get_options_interval_by_contract" end # verify enum value if @api_client.config.client_side_validation && !['SixtyMinute', '60m', '1h', 'ThirtyMinute', '30m', 'FifteenMinute', '15m', 'TenMinute', '10m', 'FiveMinute', '5m', 'OneMinute', '1m'].include?(interval_size) fail ArgumentError, "invalid value for 'interval_size', must be one of SixtyMinute, 60m, 1h, ThirtyMinute, 30m, FifteenMinute, 15m, TenMinute, 10m, FiveMinute, 5m, OneMinute, 1m" 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[:'page_size'].nil? && opts[:'page_size'] > 300 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options_interval_by_contract, must be smaller than or equal to 300.' end # resource path local_var_path = "/options/interval/{identifier}".sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'interval_size'] = interval_size query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].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 => 'OptionIntervalsResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_interval_by_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Intervals Movers # Returns a list of intervals for the biggest movers over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [OptionIntervalsMoversResult] def get_options_interval_movers(opts = {}) data, _status_code, _headers = get_options_interval_movers_with_http_info(opts) return data end # Options Intervals Movers # Returns a list of intervals for the biggest movers over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [Array<(OptionIntervalsMoversResult, Fixnum, Hash)>] OptionIntervalsMoversResult data, response status code and response headers def get_options_interval_movers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_interval_movers ..." 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/interval/movers" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'open_time'] = opts[:'open_time'] if !opts[:'open_time'].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 => 'OptionIntervalsMoversResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_interval_movers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Intervals Movers By Change # Returns a list of intervals for the biggest movers by change over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [OptionIntervalsMoversResult] def get_options_interval_movers_change(opts = {}) data, _status_code, _headers = get_options_interval_movers_change_with_http_info(opts) return data end # Options Intervals Movers By Change # Returns a list of intervals for the biggest movers by change over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [Array<(OptionIntervalsMoversResult, Fixnum, Hash)>] OptionIntervalsMoversResult data, response status code and response headers def get_options_interval_movers_change_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_interval_movers_change ..." 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/interval/movers/change" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'open_time'] = opts[:'open_time'] if !opts[:'open_time'].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 => 'OptionIntervalsMoversResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_interval_movers_change\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Intervals Movers By Volume # Returns a list of intervals for the biggest movers by volume over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [OptionIntervalsMoversResult] def get_options_interval_movers_volume(opts = {}) data, _status_code, _headers = get_options_interval_movers_volume_with_http_info(opts) return data end # Options Intervals Movers By Volume # Returns a list of intervals for the biggest movers by volume over the last hour interval. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :open_time The inclusive UTC date and time the interval opens at. # @return [Array<(OptionIntervalsMoversResult, Fixnum, Hash)>] OptionIntervalsMoversResult data, response status code and response headers def get_options_interval_movers_volume_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_interval_movers_volume ..." 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/interval/movers/volume" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'open_time'] = opts[:'open_time'] if !opts[:'open_time'].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 => 'OptionIntervalsMoversResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_interval_movers_volume\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Prices # Returns all price data from inception to expiration for a particular contract. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :start_date Return option contract prices on or after this date. # @option opts [String] :end_date Return option contract prices on or before this date. # @option opts [Integer] :page_size The number of results to return (default to 100) # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [ApiResponseOptionPrices] def get_options_prices(identifier, opts = {}) data, _status_code, _headers = get_options_prices_with_http_info(identifier, opts) return data end # Option Prices # Returns all price data from inception to expiration for a particular contract. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :start_date Return option contract prices on or after this date. # @option opts [String] :end_date Return option contract prices on or before this date. # @option opts [Integer] :page_size The number of results to return # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(ApiResponseOptionPrices, Fixnum, Hash)>] ApiResponseOptionPrices data, response status code and response headers 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 # Option Prices Batch Realtime # Returns a list of latest price data for up to 250 option contracts per request. # @param body The contract symbols for which to return options prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :show_stats Whether to include Greek calculations or not. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [ApiResponseOptionsPricesBatchRealtime] def get_options_prices_batch_realtime(body, opts = {}) data, _status_code, _headers = get_options_prices_batch_realtime_with_http_info(body, opts) return data end # Option Prices Batch Realtime # Returns a list of latest price data for up to 250 option contracts per request. # @param body The contract symbols for which to return options prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :show_stats Whether to include Greek calculations or not. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [Array<(ApiResponseOptionsPricesBatchRealtime, Fixnum, Hash)>] ApiResponseOptionsPricesBatchRealtime data, response status code and response headers def get_options_prices_batch_realtime_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices_batch_realtime ..." end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling OptionsApi.get_options_prices_batch_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[:'stock_price_source'] && !['iex', 'bats_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip', 'utp_delayed', 'otc_delayed', 'cta_a_delayed', 'cta_b_delayed', 'nasdaq_basic'].include?(opts[:'stock_price_source']) fail ArgumentError, 'invalid value for "stock_price_source", must be one of iex, bats_delayed, intrinio_mx, intrinio_mx_plus, delayed_sip, utp_delayed, otc_delayed, cta_a_delayed, cta_b_delayed, nasdaq_basic' end if @api_client.config.client_side_validation && opts[:'model'] && !['black_scholes', 'bjerk'].include?(opts[:'model']) fail ArgumentError, 'invalid value for "model", must be one of black_scholes, bjerk' end # resource path local_var_path = "/options/prices/realtime/batch" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'show_stats'] = opts[:'show_stats'] if !opts[:'show_stats'].nil? query_params[:'stock_price_source'] = opts[:'stock_price_source'] if !opts[:'stock_price_source'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ApiResponseOptionsPricesBatchRealtime') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_prices_batch_realtime\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Prices EOD # Returns all option prices for a given option contract identifier. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Date] :start_date The start date to retrieve prices for # @option opts [Date] :end_date The end date to retrieve prices for # @return [ApiResponseOptionsPricesEod] def get_options_prices_eod(identifier, opts = {}) data, _status_code, _headers = get_options_prices_eod_with_http_info(identifier, opts) return data end # Option Prices EOD # Returns all option prices for a given option contract identifier. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Date] :start_date The start date to retrieve prices for # @option opts [Date] :end_date The end date to retrieve prices for # @return [Array<(ApiResponseOptionsPricesEod, Fixnum, Hash)>] ApiResponseOptionsPricesEod data, response status code and response headers def get_options_prices_eod_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices_eod ..." 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_eod" end # resource path local_var_path = "/options/prices/{identifier}/eod".sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].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 => 'ApiResponseOptionsPricesEod') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_prices_eod\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Prices End of Day By Ticker # Returns a list of end of day pricing information for all option contracts currently associated with the ticker. # @param symbol The equities ticker symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size The number of results to return (default to 250) # @option opts [Object] :date The date to get pricing data for. Defaults to today in Eastern time zone. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [ApiResponseOptionsPricesByTickerEod] def get_options_prices_eod_by_ticker(symbol, opts = {}) data, _status_code, _headers = get_options_prices_eod_by_ticker_with_http_info(symbol, opts) return data end # Option Prices End of Day By Ticker # Returns a list of end of day pricing information for all option contracts currently associated with the ticker. # @param symbol The equities ticker symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [Integer] :page_size The number of results to return # @option opts [Object] :date The date to get pricing data for. Defaults to today in Eastern time zone. # @option opts [String] :type The option contract type. # @option opts [Float] :strike The strike price of the option contract. This will return options contracts with strike price equal to this price. # @option opts [Float] :strike_greater_than The strike price of the option contract. This will return options contracts with strike prices greater than this price. # @option opts [Float] :strike_less_than The strike price of the option contract. This will return options contracts with strike prices less than this price. # @option opts [BOOLEAN] :include_related_symbols Include related symbols that end in a 1 or 2 because of a corporate action. # @option opts [String] :next_page Gets the next page of data from a previous API call # @return [Array<(ApiResponseOptionsPricesByTickerEod, Fixnum, Hash)>] ApiResponseOptionsPricesByTickerEod data, response status code and response headers def get_options_prices_eod_by_ticker_with_http_info(symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices_eod_by_ticker ..." 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_prices_eod_by_ticker" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options_prices_eod_by_ticker, must be smaller than or equal to 1000.' 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 # resource path local_var_path = "/options/prices/by_ticker/{symbol}/eod".sub('{' + 'symbol' + '}', symbol.to_s) # query parameters query_params = {} query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? 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[:'include_related_symbols'] = opts[:'include_related_symbols'] if !opts[:'include_related_symbols'].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 => 'ApiResponseOptionsPricesByTickerEod') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_prices_eod_by_ticker\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Prices Realtime # Returns all option prices for a given option contract identifier. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [ApiResponseOptionsPriceRealtime] def get_options_prices_realtime(identifier, opts = {}) data, _status_code, _headers = get_options_prices_realtime_with_http_info(identifier, opts) return data end # Option Prices Realtime # Returns all option prices for a given option contract identifier. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [Array<(ApiResponseOptionsPriceRealtime, Fixnum, Hash)>] ApiResponseOptionsPriceRealtime data, response status code and response headers 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 if @api_client.config.client_side_validation && opts[:'stock_price_source'] && !['iex', 'bats_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip', 'utp_delayed', 'otc_delayed', 'cta_a_delayed', 'cta_b_delayed', 'nasdaq_basic'].include?(opts[:'stock_price_source']) fail ArgumentError, 'invalid value for "stock_price_source", must be one of iex, bats_delayed, intrinio_mx, intrinio_mx_plus, delayed_sip, utp_delayed, otc_delayed, cta_a_delayed, cta_b_delayed, nasdaq_basic' end if @api_client.config.client_side_validation && opts[:'model'] && !['black_scholes', 'bjerk'].include?(opts[:'model']) fail ArgumentError, 'invalid value for "model", must be one of black_scholes, bjerk' 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? query_params[:'stock_price_source'] = opts[:'stock_price_source'] if !opts[:'stock_price_source'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].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 # Option Prices Realtime By Ticker # Returns a list of the latest National Best Bid & Offer (NBBO) top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the ticker. # @param symbol The equities ticker symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :iv_mode Change the mode for the implied volatility calculation to out of the money. # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return (default to 250) # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [Object] :expiration_start_date Filter out contracts that expire before this date. # @option opts [Object] :expiration_end_date Filter out contracts that expire after this date. # @return [ApiResponseOptionsPricesByTickerRealtime] def get_options_prices_realtime_by_ticker(symbol, opts = {}) data, _status_code, _headers = get_options_prices_realtime_by_ticker_with_http_info(symbol, opts) return data end # Option Prices Realtime By Ticker # Returns a list of the latest National Best Bid & Offer (NBBO) top of the order book size and premium (bid / ask), the latest trade size and premium as well as the greeks and implied volatility for all option contracts currently associated with the ticker. # @param symbol The equities ticker symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [String] :iv_mode Change the mode for the implied volatility calculation to out of the money. # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return # @option opts [String] :stock_price_source Source for underlying price for calculating Greeks. # @option opts [String] :model Model for calculating Greek values. Default is black_scholes. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @option opts [Object] :expiration_start_date Filter out contracts that expire before this date. # @option opts [Object] :expiration_end_date Filter out contracts that expire after this date. # @return [Array<(ApiResponseOptionsPricesByTickerRealtime, Fixnum, Hash)>] ApiResponseOptionsPricesByTickerRealtime data, response status code and response headers def get_options_prices_realtime_by_ticker_with_http_info(symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_prices_realtime_by_ticker ..." 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_prices_realtime_by_ticker" 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[:'iv_mode'] && !['out_of_the_money'].include?(opts[:'iv_mode']) fail ArgumentError, 'invalid value for "iv_mode", must be one of out_of_the_money' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_options_prices_realtime_by_ticker, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && opts[:'stock_price_source'] && !['iex', 'bats_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip', 'utp_delayed', 'otc_delayed', 'cta_a_delayed', 'cta_b_delayed', 'nasdaq_basic'].include?(opts[:'stock_price_source']) fail ArgumentError, 'invalid value for "stock_price_source", must be one of iex, bats_delayed, intrinio_mx, intrinio_mx_plus, delayed_sip, utp_delayed, otc_delayed, cta_a_delayed, cta_b_delayed, nasdaq_basic' end if @api_client.config.client_side_validation && opts[:'model'] && !['black_scholes', 'bjerk'].include?(opts[:'model']) fail ArgumentError, 'invalid value for "model", must be one of black_scholes, bjerk' end # resource path local_var_path = "/options/prices/by_ticker/{symbol}/realtime".sub('{' + 'symbol' + '}', symbol.to_s) # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'iv_mode'] = opts[:'iv_mode'] if !opts[:'iv_mode'].nil? query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'stock_price_source'] = opts[:'stock_price_source'] if !opts[:'stock_price_source'].nil? query_params[:'model'] = opts[:'model'] if !opts[:'model'].nil? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].nil? query_params[:'expiration_start_date'] = opts[:'expiration_start_date'] if !opts[:'expiration_start_date'].nil? query_params[:'expiration_end_date'] = opts[:'expiration_end_date'] if !opts[:'expiration_end_date'].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 => 'ApiResponseOptionsPricesByTickerRealtime') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_prices_realtime_by_ticker\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Prices Realtime Snapshot # Returns all options snapshots for the queried interval with links to download. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :at_datetime The UTC date and time (with url-encoded spaces) the snapshot will cover. # @return [OptionSnapshotsResult] def get_options_snapshots(opts = {}) data, _status_code, _headers = get_options_snapshots_with_http_info(opts) return data end # Option Prices Realtime Snapshot # Returns all options snapshots for the queried interval with links to download. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [DateTime] :at_datetime The UTC date and time (with url-encoded spaces) the snapshot will cover. # @return [Array<(OptionSnapshotsResult, Fixnum, Hash)>] OptionSnapshotsResult data, response status code and response headers def get_options_snapshots_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_options_snapshots ..." 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/snapshots" # query parameters query_params = {} query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil? query_params[:'at_datetime'] = opts[:'at_datetime'] if !opts[:'at_datetime'].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 => 'OptionSnapshotsResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_options_snapshots\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Option Stats Realtime # Returns all option stats (greeks and implied volatility) as well as the underlying factors used to calculate them, for a particular option contract. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [ApiResponseOptionsStatsRealtime] def get_options_stats_realtime(identifier, opts = {}) data, _status_code, _headers = get_options_stats_realtime_with_http_info(identifier, opts) return data end # Option Stats Realtime # Returns all option stats (greeks and implied volatility) as well as the underlying factors used to calculate them, for a particular option contract. # @param identifier The Intrinio ID or code of the options contract to request prices for. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @option opts [BOOLEAN] :show_extended_price Whether to include open close high low type fields. # @return [Array<(ApiResponseOptionsStatsRealtime, Fixnum, Hash)>] ApiResponseOptionsStatsRealtime data, response status code and response headers 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? query_params[:'show_extended_price'] = opts[:'show_extended_price'] if !opts[:'show_extended_price'].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 # Options Unusual Activity # Returns unusual options activity for a particular company across all option chains. Unusual options activity includes large trades, sweeps, and block trades. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @return [ApiResponseOptionsUnusualActivity] def get_unusual_activity(symbol, opts = {}) data, _status_code, _headers = get_unusual_activity_with_http_info(symbol, opts) return data end # Options Unusual Activity # Returns unusual options activity for a particular company across all option chains. Unusual options activity includes large trades, sweeps, and block trades. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @return [Array<(ApiResponseOptionsUnusualActivity, Fixnum, Hash)>] ApiResponseOptionsUnusualActivity data, response status code and response headers def get_unusual_activity_with_http_info(symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_unusual_activity ..." 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_unusual_activity" 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/unusual_activity/{symbol}".sub('{' + 'symbol' + '}', symbol.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 => 'ApiResponseOptionsUnusualActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_unusual_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Unusual Activity Intraday # Returns unusual trades for a given identifier within the query parameters. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return (default to 1000) # @option opts [String] :activity_type The unusual activity type to query for. # @option opts [String] :sentiment The sentiment type to query for. # @option opts [Date] :start_date Return unusual activity on or after this date. # @option opts [Date] :end_date Return unusual activity on or before this date. # @option opts [Object] :minimum_total_value The inclusive minimum total value for the unusual activity. # @option opts [Object] :maximum_total_value The inclusive maximum total value for the unusual activity. # @return [ApiResponseOptionsUnusualActivity] def get_unusual_activity_intraday(symbol, opts = {}) data, _status_code, _headers = get_unusual_activity_intraday_with_http_info(symbol, opts) return data end # Options Unusual Activity Intraday # Returns unusual trades for a given identifier within the query parameters. # @param symbol The option symbol, corresponding to the underlying security. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return # @option opts [String] :activity_type The unusual activity type to query for. # @option opts [String] :sentiment The sentiment type to query for. # @option opts [Date] :start_date Return unusual activity on or after this date. # @option opts [Date] :end_date Return unusual activity on or before this date. # @option opts [Object] :minimum_total_value The inclusive minimum total value for the unusual activity. # @option opts [Object] :maximum_total_value The inclusive maximum total value for the unusual activity. # @return [Array<(ApiResponseOptionsUnusualActivity, Fixnum, Hash)>] ApiResponseOptionsUnusualActivity data, response status code and response headers def get_unusual_activity_intraday_with_http_info(symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_unusual_activity_intraday ..." 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_unusual_activity_intraday" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_unusual_activity_intraday, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && opts[:'activity_type'] && !['block', 'sweep', 'large'].include?(opts[:'activity_type']) fail ArgumentError, 'invalid value for "activity_type", must be one of block, sweep, large' end if @api_client.config.client_side_validation && opts[:'sentiment'] && !['bullish', 'bearish', 'neutral'].include?(opts[:'sentiment']) fail ArgumentError, 'invalid value for "sentiment", must be one of bullish, bearish, neutral' end # resource path local_var_path = "/options/unusual_activity/{symbol}/intraday".sub('{' + 'symbol' + '}', symbol.to_s) # query parameters query_params = {} query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'activity_type'] = opts[:'activity_type'] if !opts[:'activity_type'].nil? query_params[:'sentiment'] = opts[:'sentiment'] if !opts[:'sentiment'].nil? 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[:'minimum_total_value'] = opts[:'minimum_total_value'] if !opts[:'minimum_total_value'].nil? query_params[:'maximum_total_value'] = opts[:'maximum_total_value'] if !opts[:'maximum_total_value'].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 => 'ApiResponseOptionsUnusualActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_unusual_activity_intraday\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Unusual Activity Universal # Returns the latest unusual options activity across all US companies with across all option chains. Unusual options activity includes large trades, sweeps, and block trades. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @return [ApiResponseOptionsUnusualActivity] def get_unusual_activity_universal(opts = {}) data, _status_code, _headers = get_unusual_activity_universal_with_http_info(opts) return data end # Options Unusual Activity Universal # Returns the latest unusual options activity across all US companies with across all option chains. Unusual options activity includes large trades, sweeps, and block trades. # @param [Hash] opts the optional parameters # @option opts [String] :source Realtime or 15-minute delayed contracts. # @return [Array<(ApiResponseOptionsUnusualActivity, Fixnum, Hash)>] ApiResponseOptionsUnusualActivity data, response status code and response headers def get_unusual_activity_universal_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_unusual_activity_universal ..." 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/unusual_activity" # 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 => 'ApiResponseOptionsUnusualActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_unusual_activity_universal\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Options Unusual Activity Universal Intraday # Returns unusual trades for all underlying security symbols within the query parameters. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return (default to 1000) # @option opts [String] :activity_type The unusual activity type to query for. # @option opts [String] :sentiment The sentiment type to query for. # @option opts [Date] :start_date Return unusual activity on or after this date. # @option opts [Date] :end_date Return unusual activity on or before this date. # @option opts [Object] :minimum_total_value The inclusive minimum total value for the unusual activity. # @option opts [Object] :maximum_total_value The inclusive maximum total value for the unusual activity. # @return [ApiResponseOptionsUnusualActivity] def get_unusual_activity_universal_intraday(opts = {}) data, _status_code, _headers = get_unusual_activity_universal_intraday_with_http_info(opts) return data end # Options Unusual Activity Universal Intraday # Returns unusual trades for all underlying security symbols within the query parameters. # @param [Hash] opts the optional parameters # @option opts [String] :next_page Gets the next page of data from a previous API call # @option opts [Integer] :page_size The number of results to return # @option opts [String] :activity_type The unusual activity type to query for. # @option opts [String] :sentiment The sentiment type to query for. # @option opts [Date] :start_date Return unusual activity on or after this date. # @option opts [Date] :end_date Return unusual activity on or before this date. # @option opts [Object] :minimum_total_value The inclusive minimum total value for the unusual activity. # @option opts [Object] :maximum_total_value The inclusive maximum total value for the unusual activity. # @return [Array<(ApiResponseOptionsUnusualActivity, Fixnum, Hash)>] ApiResponseOptionsUnusualActivity data, response status code and response headers def get_unusual_activity_universal_intraday_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OptionsApi.get_unusual_activity_universal_intraday ..." end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling OptionsApi.get_unusual_activity_universal_intraday, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && opts[:'activity_type'] && !['block', 'sweep', 'large'].include?(opts[:'activity_type']) fail ArgumentError, 'invalid value for "activity_type", must be one of block, sweep, large' end if @api_client.config.client_side_validation && opts[:'sentiment'] && !['bullish', 'bearish', 'neutral'].include?(opts[:'sentiment']) fail ArgumentError, 'invalid value for "sentiment", must be one of bullish, bearish, neutral' end # resource path local_var_path = "/options/unusual_activity/intraday" # query parameters query_params = {} query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'activity_type'] = opts[:'activity_type'] if !opts[:'activity_type'].nil? query_params[:'sentiment'] = opts[:'sentiment'] if !opts[:'sentiment'].nil? 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[:'minimum_total_value'] = opts[:'minimum_total_value'] if !opts[:'minimum_total_value'].nil? query_params[:'maximum_total_value'] = opts[:'maximum_total_value'] if !opts[:'maximum_total_value'].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 => 'ApiResponseOptionsUnusualActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: OptionsApi#get_unusual_activity_universal_intraday\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end