Class: Intrinio::StockExchangeApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ StockExchangeApi

Returns a new instance of StockExchangeApi.



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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#get_all_stock_exchanges(opts = {}) ⇒ ApiResponseStockExchanges

All Stock Exchanges Returns all Stock Exchanges matching the specified parameters

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :city (String)

    Filter by city

  • :country (String)

    Filter by country

  • :country_code (String)

    Filter by ISO country code

  • :page_size (Integer)

    The number of results to return (default to 100)

Returns:



31
32
33
34
# 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 = {}) ⇒ Array<(ApiResponseStockExchanges, Fixnum, Hash)>

All Stock Exchanges Returns all Stock Exchanges matching the specified parameters

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :city (String)

    Filter by city

  • :country (String)

    Filter by country

  • :country_code (String)

    Filter by ISO country code

  • :page_size (Integer)

    The number of results to return

Returns:

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

    ApiResponseStockExchanges data, response status code and response headers



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# 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 = {}) ⇒ StockExchange

Lookup Stock Exchange Returns the Stock Exchange with the given ‘identifier`

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Returns:



91
92
93
94
# 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 = {}) ⇒ Array<(StockExchange, Fixnum, Hash)>

Lookup Stock Exchange Returns the Stock Exchange with the given &#x60;identifier&#x60;

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Returns:

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

    StockExchange data, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 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 = {}) ⇒ ApiResponseStockExchangeStockPriceAdjustments

Stock Price Adjustments by Exchange Returns stock price adjustments for the Stock Exchange with the given ‘identifier`

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date for which to return price adjustments

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



147
148
149
150
# 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 = {}) ⇒ Array<(ApiResponseStockExchangeStockPriceAdjustments, Fixnum, Hash)>

Stock Price Adjustments by Exchange Returns stock price adjustments for the Stock Exchange with the given &#x60;identifier&#x60;

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date for which to return price adjustments

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# 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 = {}) ⇒ ApiResponseStockExchangeStockPrices

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)

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date for which to return prices. May not be used with the start_date and end_date parameters.

  • :start_date (Date)

    The start of the date range you&#39;re querying. May not be used with date parameter.

  • :end_date (Date)

    The end of the date range you&#39;re querying. May not be used with date parameter.

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :next_page (String)

    Gets the next page of data from a previous API call

  • :tickers (Array<String>)

    The comma-delimited list of ticker symbols to filter down to. If not provided, the entire stock exchange is returned.

  • :next_page2 (String)

    Gets the next page of data from a previous API call

Returns:



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

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 = {}) ⇒ Array<(ApiResponseStockExchangeStockPrices, Fixnum, Hash)>

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)

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :date (Date)

    The date for which to return prices. May not be used with the start_date and end_date parameters.

  • :start_date (Date)

    The start of the date range you&#39;re querying. May not be used with date parameter.

  • :end_date (Date)

    The end of the date range you&#39;re querying. May not be used with date parameter.

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

  • :tickers (Array<String>)

    The comma-delimited list of ticker symbols to filter down to. If not provided, the entire stock exchange is returned.

  • :next_page2 (String)

    Gets the next page of data from a previous API call

Returns:



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/intrinio-sdk/api/stock_exchange_api.rb', line 234

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[:'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?
  query_params[:'tickers'] = @api_client.build_collection_param(opts[:'tickers'], :csv) if !opts[:'tickers'].nil?
  query_params[:'next_page'] = opts[:'next_page2'] if !opts[:'next_page2'].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 = {}) ⇒ ApiResponseStockExchangeRealtimeStockPrices

Realtime Stock Prices by Exchange Returns realtime stock prices for the Stock Exchange with the given ‘identifier`

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :source (Array<String>)

    Return realtime prices from the specified comma-delimited data sources. If no source is specified, all sources available to user are used.

  • :active_only (BOOLEAN)

    Returns prices only from the most recent trading day.

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :tickers (Array<String>)

    The comma-delimited list of ticker symbols to filter to. If not provided, the entire stock exchange is returned.

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



293
294
295
296
# File 'lib/intrinio-sdk/api/stock_exchange_api.rb', line 293

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 = {}) ⇒ Array<(ApiResponseStockExchangeRealtimeStockPrices, Fixnum, Hash)>

Realtime Stock Prices by Exchange Returns realtime stock prices for the Stock Exchange with the given &#x60;identifier&#x60;

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :source (Array<String>)

    Return realtime prices from the specified comma-delimited data sources. If no source is specified, all sources available to user are used.

  • :active_only (BOOLEAN)

    Returns prices only from the most recent trading day.

  • :page_size (Integer)

    The number of results to return

  • :tickers (Array<String>)

    The comma-delimited list of ticker symbols to filter to. If not provided, the entire stock exchange is returned.

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



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

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'] && !opts[:'source'].all?{|item| ['iex', 'bats_delayed', 'utp_delayed', 'cta_a_delayed', 'cta_b_delayed', 'otc_delayed', 'delayed_sip', 'nasdaq_basic', 'intrinio_mx', 'intrinio_mx_plus'].include?(item)}
    fail ArgumentError, 'invalid value for "source", must include one of iex, bats_delayed, utp_delayed, cta_a_delayed, cta_b_delayed, otc_delayed, delayed_sip, nasdaq_basic, intrinio_mx, intrinio_mx_plus'
  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'] = @api_client.build_collection_param(opts[:'source'], :csv) if !opts[:'source'].nil?
  query_params[:'active_only'] = opts[:'active_only'] if !opts[:'active_only'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'tickers'] = @api_client.build_collection_param(opts[:'tickers'], :csv) if !opts[:'tickers'].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 = {}) ⇒ ApiResponseStockExchangeSecurities

Securities by Exchange Returns Securities traded on the Stock Exchange with ‘identifier`

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    The number of results to return (default to 100)

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



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

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 = {}) ⇒ Array<(ApiResponseStockExchangeSecurities, Fixnum, Hash)>

Securities by Exchange Returns Securities traded on the Stock Exchange with &#x60;identifier&#x60;

Parameters:

  • identifier

    A Stock Exchange identifier (MIC or Intrinio ID)

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

    the optional parameters

Options Hash (opts):

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



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

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