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

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



213
214
215
216
# 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 = {}) ⇒ 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

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# 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 = {}) ⇒ 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 (String)

    Return realtime prices from the specified data source. If no source is specified, all sources are used.

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



279
280
281
282
# 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 = {}) ⇒ 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 (String)

    Return realtime prices from the specified data source. If no source is specified, all sources are used.

  • :page_size (Integer)

    The number of results to return

  • :next_page (String)

    Gets the next page of data from a previous API call

Returns:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# 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', 'intrinio_mx'].include?(opts[:'source'])
    fail ArgumentError, 'invalid value for "source", must be one of iex, bats, bats_delayed, intrinio_mx'
  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 = {}) ⇒ 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:



347
348
349
350
# 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 = {}) ⇒ 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:



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
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
# 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