class Intrinio::StockExchangeApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_all_stock_exchanges(opts = {}) click to toggle source

All Stock Exchanges Returns all Stock Exchanges matching the specified parameters @param [Hash] opts the optional parameters @option opts [String] :city Filter by city @option opts [String] :country Filter by country @option opts [String] :country_code Filter by ISO country code @option opts [Integer] :page_size The number of results to return (default to 100) @return [ApiResponseStockExchanges]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 31
def get_all_stock_exchanges(opts = {})
  data, _status_code, _headers = get_all_stock_exchanges_with_http_info(opts)
  return data
end
get_all_stock_exchanges_with_http_info(opts = {}) click to toggle source

All Stock Exchanges Returns all Stock Exchanges matching the specified parameters @param [Hash] opts the optional parameters @option opts [String] :city Filter by city @option opts [String] :country Filter by country @option opts [String] :country_code Filter by ISO country code @option opts [Integer] :page_size The number of results to return @return [Array<(ApiResponseStockExchanges, Fixnum, Hash)>] ApiResponseStockExchanges data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 44
def get_all_stock_exchanges_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_all_stock_exchanges ..."
  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 StockExchangeApi.get_all_stock_exchanges, must be smaller than or equal to 10000.'
  end

  # resource path
  local_var_path = "/stock_exchanges"

  # query parameters
  query_params = {}
  query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil?
  query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil?
  query_params[:'country_code'] = opts[:'country_code'] if !opts[:'country_code'].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 => 'ApiResponseStockExchanges')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_all_stock_exchanges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_stock_exchange_by_id(identifier, opts = {}) click to toggle source

Lookup Stock Exchange Returns the Stock Exchange with the given `identifier` @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @return [StockExchange]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 91
def get_stock_exchange_by_id(identifier, opts = {})
  data, _status_code, _headers = get_stock_exchange_by_id_with_http_info(identifier, opts)
  return data
end
get_stock_exchange_by_id_with_http_info(identifier, opts = {}) click to toggle source

Lookup Stock Exchange Returns the Stock Exchange with the given &#x60;identifier&#x60; @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @return [Array<(StockExchange, Fixnum, Hash)>] StockExchange data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 101
def get_stock_exchange_by_id_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_stock_exchange_by_id ..."
  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 StockExchangeApi.get_stock_exchange_by_id"
  end
  # resource path
  local_var_path = "/stock_exchanges/{identifier}".sub('{' + 'identifier' + '}', identifier.to_s)

  # 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 => 'StockExchange')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_stock_exchange_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_stock_exchange_price_adjustments(identifier, opts = {}) click to toggle source

Stock Price Adjustments by Exchange Returns stock price adjustments for the Stock Exchange with the given `identifier` @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [Date] :date The date for which to return price adjustments @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 [ApiResponseStockExchangeStockPriceAdjustments]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 147
def get_stock_exchange_price_adjustments(identifier, opts = {})
  data, _status_code, _headers = get_stock_exchange_price_adjustments_with_http_info(identifier, opts)
  return data
end
get_stock_exchange_price_adjustments_with_http_info(identifier, opts = {}) click to toggle source

Stock Price Adjustments by Exchange Returns stock price adjustments for the Stock Exchange with the given &#x60;identifier&#x60; @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [Date] :date The date for which to return price adjustments @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<(ApiResponseStockExchangeStockPriceAdjustments, Fixnum, Hash)>] ApiResponseStockExchangeStockPriceAdjustments data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 160
def get_stock_exchange_price_adjustments_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_stock_exchange_price_adjustments ..."
  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 StockExchangeApi.get_stock_exchange_price_adjustments"
  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 StockExchangeApi.get_stock_exchange_price_adjustments, must be smaller than or equal to 10000.'
  end

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

  # 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 => 'ApiResponseStockExchangeStockPriceAdjustments')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_stock_exchange_price_adjustments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_stock_exchange_prices(identifier, opts = {}) click to toggle source

Stock Prices by Exchange Returns end-of-day stock prices for Securities on the Stock Exchange with `identifier` and on the `price_date` (or the latest date that prices are available) @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [Date] :date The date for which to return prices @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 [ApiResponseStockExchangeStockPrices]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 213
def get_stock_exchange_prices(identifier, opts = {})
  data, _status_code, _headers = get_stock_exchange_prices_with_http_info(identifier, opts)
  return data
end
get_stock_exchange_prices_with_http_info(identifier, opts = {}) click to toggle source

Stock Prices by Exchange Returns end-of-day stock prices for Securities on the Stock Exchange with &#x60;identifier&#x60; and on the &#x60;price_date&#x60; (or the latest date that prices are available) @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [Date] :date The date for which to return prices @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<(ApiResponseStockExchangeStockPrices, Fixnum, Hash)>] ApiResponseStockExchangeStockPrices data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 226
def get_stock_exchange_prices_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_stock_exchange_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 StockExchangeApi.get_stock_exchange_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 StockExchangeApi.get_stock_exchange_prices, must be smaller than or equal to 10000.'
  end

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

  # 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 => 'ApiResponseStockExchangeStockPrices')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_stock_exchange_prices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_stock_exchange_realtime_prices(identifier, opts = {}) click to toggle source

Realtime Stock Prices by Exchange Returns realtime stock prices for the Stock Exchange with the given `identifier` @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [String] :source Return realtime prices from the specified data source. If no source is specified, all sources are used. @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 [ApiResponseStockExchangeRealtimeStockPrices]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 279
def get_stock_exchange_realtime_prices(identifier, opts = {})
  data, _status_code, _headers = get_stock_exchange_realtime_prices_with_http_info(identifier, opts)
  return data
end
get_stock_exchange_realtime_prices_with_http_info(identifier, opts = {}) click to toggle source

Realtime Stock Prices by Exchange Returns realtime stock prices for the Stock Exchange with the given &#x60;identifier&#x60; @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @option opts [String] :source Return realtime prices from the specified data source. If no source is specified, all sources are used. @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<(ApiResponseStockExchangeRealtimeStockPrices, Fixnum, Hash)>] ApiResponseStockExchangeRealtimeStockPrices data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 292
def get_stock_exchange_realtime_prices_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_stock_exchange_realtime_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 StockExchangeApi.get_stock_exchange_realtime_prices"
  end
  if @api_client.config.client_side_validation && opts[:'source'] && !['iex', 'bats', 'bats_delayed'].include?(opts[:'source'])
    fail ArgumentError, 'invalid value for "source", must be one of iex, bats, bats_delayed'
  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 StockExchangeApi.get_stock_exchange_realtime_prices, must be smaller than or equal to 10000.'
  end

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

  # query parameters
  query_params = {}
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].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 => 'ApiResponseStockExchangeRealtimeStockPrices')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_stock_exchange_realtime_prices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_stock_exchange_securities(identifier, opts = {}) click to toggle source

Securities by Exchange Returns Securities traded on the Stock Exchange with `identifier` @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @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 [ApiResponseStockExchangeSecurities]

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 347
def get_stock_exchange_securities(identifier, opts = {})
  data, _status_code, _headers = get_stock_exchange_securities_with_http_info(identifier, opts)
  return data
end
get_stock_exchange_securities_with_http_info(identifier, opts = {}) click to toggle source

Securities by Exchange Returns Securities traded on the Stock Exchange with &#x60;identifier&#x60; @param identifier A Stock Exchange identifier (MIC or Intrinio ID) @param [Hash] opts the optional parameters @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<(ApiResponseStockExchangeSecurities, Fixnum, Hash)>] ApiResponseStockExchangeSecurities data, response status code and response headers

# File lib/intrinio-sdk/api/stock_exchange_api.rb, line 359
def get_stock_exchange_securities_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: StockExchangeApi.get_stock_exchange_securities ..."
  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 StockExchangeApi.get_stock_exchange_securities"
  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 StockExchangeApi.get_stock_exchange_securities, must be smaller than or equal to 10000.'
  end

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

  # query parameters
  query_params = {}
  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 => 'ApiResponseStockExchangeSecurities')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: StockExchangeApi#get_stock_exchange_securities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end