Class: SnapTrade::ReferenceDataApi

Inherits:
Object
  • Object
show all
Defined in:
lib/snaptrade/api/reference_data_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ReferenceDataApi

Returns a new instance of ReferenceDataApi.



16
17
18
# File 'lib/snaptrade/api/reference_data_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/snaptrade/api/reference_data_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_partner_info(extra: {}) ⇒ Object

Get Client Info

Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



25
26
27
28
# File 'lib/snaptrade/api/reference_data_api.rb', line 25

def get_partner_info(extra: {})
  data, _status_code, _headers = get_partner_info_with_http_info_impl(extra)
  data
end

#get_partner_info_with_http_info(extra: {}) ⇒ Object

Get Client Info

Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



35
36
37
# File 'lib/snaptrade/api/reference_data_api.rb', line 35

def get_partner_info_with_http_info(extra: {})
  get_partner_info_with_http_info_impl(extra)
end

#get_stock_exchanges(extra: {}) ⇒ Object

Get exchanges

Returns a list of all supported Exchanges.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



102
103
104
105
# File 'lib/snaptrade/api/reference_data_api.rb', line 102

def get_stock_exchanges(extra: {})
  data, _status_code, _headers = get_stock_exchanges_with_http_info_impl(extra)
  data
end

#get_stock_exchanges_with_http_info(extra: {}) ⇒ Object

Get exchanges

Returns a list of all supported Exchanges.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



112
113
114
# File 'lib/snaptrade/api/reference_data_api.rb', line 112

def get_stock_exchanges_with_http_info(extra: {})
  get_stock_exchanges_with_http_info_impl(extra)
end

#get_symbols(substring: SENTINEL, extra: {}) ⇒ Object

Search symbols

Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.

Parameters:

  • substring (String) (defaults to: SENTINEL)

    The search query for symbols.

  • body (SymbolQuery)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



181
182
183
184
185
186
187
# File 'lib/snaptrade/api/reference_data_api.rb', line 181

def get_symbols(substring: SENTINEL, extra: {})
  _body = {}
  _body[:substring] = substring if substring != SENTINEL
  extra[:symbol_query] = _body if !_body.empty?
  data, _status_code, _headers = get_symbols_with_http_info_impl(extra)
  data
end

#get_symbols_by_ticker(query:, extra: {}) ⇒ Object

Get symbol detail

Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the Yahoo Finance ticker format(click on "Yahoo Finance Market Coverage and Data Delays"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.

Parameters:

  • query (String)

    The ticker or Universal Symbol ID to look up the symbol with.

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



274
275
276
277
# File 'lib/snaptrade/api/reference_data_api.rb', line 274

def get_symbols_by_ticker(query:, extra: {})
  data, _status_code, _headers = get_symbols_by_ticker_with_http_info_impl(query, extra)
  data
end

#get_symbols_by_ticker_with_http_info(query:, extra: {}) ⇒ Object

Get symbol detail

Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the Yahoo Finance ticker format(click on "Yahoo Finance Market Coverage and Data Delays"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.

Parameters:

  • query (String)

    The ticker or Universal Symbol ID to look up the symbol with.

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



285
286
287
# File 'lib/snaptrade/api/reference_data_api.rb', line 285

def get_symbols_by_ticker_with_http_info(query:, extra: {})
  get_symbols_by_ticker_with_http_info_impl(query, extra)
end

#get_symbols_with_http_info(substring: SENTINEL, extra: {}) ⇒ Object

Search symbols

Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.

Parameters:

  • substring (String) (defaults to: SENTINEL)

    The search query for symbols.

  • body (SymbolQuery)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



196
197
198
199
200
201
# File 'lib/snaptrade/api/reference_data_api.rb', line 196

def get_symbols_with_http_info(substring: SENTINEL, extra: {})
  _body = {}
  _body[:substring] = substring if substring != SENTINEL
  extra[:symbol_query] = _body if !_body.empty?
  get_symbols_with_http_info_impl(extra)
end

#list_all_brokerage_authorization_type(brokerage: SENTINEL, extra: {}) ⇒ Object

Get all brokerage authorization types

Returns a list of all defined Brokerage authorization Type objects.

Parameters:

  • brokerage (String) (defaults to: SENTINEL)

    Comma separated value of brokerage slugs

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



359
360
361
362
363
# File 'lib/snaptrade/api/reference_data_api.rb', line 359

def list_all_brokerage_authorization_type(brokerage: SENTINEL, extra: {})
  extra[:brokerage] = brokerage if brokerage != SENTINEL
  data, _status_code, _headers = list_all_brokerage_authorization_type_with_http_info_impl(extra)
  data
end

#list_all_brokerage_authorization_type_with_http_info(brokerage: SENTINEL, extra: {}) ⇒ Object

Get all brokerage authorization types

Returns a list of all defined Brokerage authorization Type objects.

Parameters:

  • brokerage (String) (defaults to: SENTINEL)

    Comma separated value of brokerage slugs

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



371
372
373
374
# File 'lib/snaptrade/api/reference_data_api.rb', line 371

def list_all_brokerage_authorization_type_with_http_info(brokerage: SENTINEL, extra: {})
  extra[:brokerage] = brokerage if brokerage != SENTINEL
  list_all_brokerage_authorization_type_with_http_info_impl(extra)
end

#list_all_brokerage_instruments(slug:, extra: {}) ⇒ Object

Get brokerage instruments

Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.

Parameters:

  • slug (String)

    A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change.

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



443
444
445
446
# File 'lib/snaptrade/api/reference_data_api.rb', line 443

def list_all_brokerage_instruments(slug:, extra: {})
  data, _status_code, _headers = list_all_brokerage_instruments_with_http_info_impl(slug, extra)
  data
end

#list_all_brokerage_instruments_with_http_info(slug:, extra: {}) ⇒ Object

Get brokerage instruments

Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.

Parameters:

  • slug (String)

    A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change.

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



454
455
456
# File 'lib/snaptrade/api/reference_data_api.rb', line 454

def list_all_brokerage_instruments_with_http_info(slug:, extra: {})
  list_all_brokerage_instruments_with_http_info_impl(slug, extra)
end

#list_all_brokerages(extra: {}) ⇒ Object

Get brokerages

Returns a list of all defined Brokerage objects.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



527
528
529
530
# File 'lib/snaptrade/api/reference_data_api.rb', line 527

def list_all_brokerages(extra: {})
  data, _status_code, _headers = list_all_brokerages_with_http_info_impl(extra)
  data
end

#list_all_brokerages_with_http_info(extra: {}) ⇒ Object

Get brokerages

Returns a list of all defined Brokerage objects.

Parameters:

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

    additional parameters to pass along through :header_params, :query_params, or parameter name



537
538
539
# File 'lib/snaptrade/api/reference_data_api.rb', line 537

def list_all_brokerages_with_http_info(extra: {})
  list_all_brokerages_with_http_info_impl(extra)
end

#symbol_search_user_account(user_id:, user_secret:, account_id:, substring: SENTINEL, extra: {}) ⇒ Object

Search account symbols

Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.

The search results are further limited to the symbols supported by the brokerage for which the account is under.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • substring (String) (defaults to: SENTINEL)

    The search query for symbols.

  • body (SymbolQuery)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



611
612
613
614
615
616
617
# File 'lib/snaptrade/api/reference_data_api.rb', line 611

def (user_id:, user_secret:, account_id:, substring: SENTINEL, extra: {})
  _body = {}
  _body[:substring] = substring if substring != SENTINEL
  extra[:symbol_query] = _body if !_body.empty?
  data, _status_code, _headers = (user_id, user_secret, , extra)
  data
end

#symbol_search_user_account_with_http_info(user_id:, user_secret:, account_id:, substring: SENTINEL, extra: {}) ⇒ Object

Search account symbols

Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.

The search results are further limited to the symbols supported by the brokerage for which the account is under.

Parameters:

  • user_id (String)
  • user_secret (String)
  • account_id (String)
  • substring (String) (defaults to: SENTINEL)

    The search query for symbols.

  • body (SymbolQuery)
  • extra (Hash) (defaults to: {})

    additional parameters to pass along through :header_params, :query_params, or parameter name



631
632
633
634
635
636
# File 'lib/snaptrade/api/reference_data_api.rb', line 631

def (user_id:, user_secret:, account_id:, substring: SENTINEL, extra: {})
  _body = {}
  _body[:substring] = substring if substring != SENTINEL
  extra[:symbol_query] = _body if !_body.empty?
  (user_id, user_secret, , extra)
end