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_currency_exchange_rate_pair(currency_pair:, extra: {}) ⇒ Object

Get exchange rate of a currency pair

Returns an Exchange Rate Pair object for the specified Currency Pair.

Parameters:

  • currency_pair (String)

    A currency pair based on currency code for example, CAD-USD

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

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



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

def get_currency_exchange_rate_pair(currency_pair:, extra: {})
  data, _status_code, _headers = get_currency_exchange_rate_pair_with_http_info_impl(currency_pair, extra)
  data
end

#get_currency_exchange_rate_pair_with_http_info(currency_pair:, extra: {}) ⇒ Object

Get exchange rate of a currency pair

Returns an Exchange Rate Pair object for the specified Currency Pair.

Parameters:

  • currency_pair (String)

    A currency pair based on currency code for example, CAD-USD

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

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



37
38
39
# File 'lib/snaptrade/api/reference_data_api.rb', line 37

def get_currency_exchange_rate_pair_with_http_info(currency_pair:, extra: {})
  get_currency_exchange_rate_pair_with_http_info_impl(currency_pair, extra)
end

#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



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

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



120
121
122
# File 'lib/snaptrade/api/reference_data_api.rb', line 120

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

#get_security_types(extra: {}) ⇒ Object

List security types

Return all available security types supported by SnapTrade.

Parameters:

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

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



187
188
189
190
# File 'lib/snaptrade/api/reference_data_api.rb', line 187

def get_security_types(extra: {})
  data, _status_code, _headers = get_security_types_with_http_info_impl(extra)
  data
end

#get_security_types_with_http_info(extra: {}) ⇒ Object

List security types

Return all available security types supported by SnapTrade.

Parameters:

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

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



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

def get_security_types_with_http_info(extra: {})
  get_security_types_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



264
265
266
267
# File 'lib/snaptrade/api/reference_data_api.rb', line 264

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



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

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



343
344
345
346
347
348
349
# File 'lib/snaptrade/api/reference_data_api.rb', line 343

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](help.yahoo.com/kb/SLN2310.html)(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



436
437
438
439
# File 'lib/snaptrade/api/reference_data_api.rb', line 436

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](help.yahoo.com/kb/SLN2310.html)(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



447
448
449
# File 'lib/snaptrade/api/reference_data_api.rb', line 447

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



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

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



521
522
523
524
525
# File 'lib/snaptrade/api/reference_data_api.rb', line 521

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



533
534
535
536
# File 'lib/snaptrade/api/reference_data_api.rb', line 533

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



605
606
607
608
# File 'lib/snaptrade/api/reference_data_api.rb', line 605

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



616
617
618
# File 'lib/snaptrade/api/reference_data_api.rb', line 616

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



689
690
691
692
# File 'lib/snaptrade/api/reference_data_api.rb', line 689

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



699
700
701
# File 'lib/snaptrade/api/reference_data_api.rb', line 699

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

#list_all_currencies(extra: {}) ⇒ Object

Get currencies

Returns a list of all defined Currency objects.

Parameters:

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

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



766
767
768
769
# File 'lib/snaptrade/api/reference_data_api.rb', line 766

def list_all_currencies(extra: {})
  data, _status_code, _headers = list_all_currencies_with_http_info_impl(extra)
  data
end

#list_all_currencies_rates(extra: {}) ⇒ Object

Get currency exchange rates

Returns a list of all Exchange Rate Pairs for all supported Currencies.

Parameters:

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

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



843
844
845
846
# File 'lib/snaptrade/api/reference_data_api.rb', line 843

def list_all_currencies_rates(extra: {})
  data, _status_code, _headers = list_all_currencies_rates_with_http_info_impl(extra)
  data
end

#list_all_currencies_rates_with_http_info(extra: {}) ⇒ Object

Get currency exchange rates

Returns a list of all Exchange Rate Pairs for all supported Currencies.

Parameters:

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

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



853
854
855
# File 'lib/snaptrade/api/reference_data_api.rb', line 853

def list_all_currencies_rates_with_http_info(extra: {})
  list_all_currencies_rates_with_http_info_impl(extra)
end

#list_all_currencies_with_http_info(extra: {}) ⇒ Object

Get currencies

Returns a list of all defined Currency objects.

Parameters:

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

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



776
777
778
# File 'lib/snaptrade/api/reference_data_api.rb', line 776

def list_all_currencies_with_http_info(extra: {})
  list_all_currencies_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



927
928
929
930
931
932
933
# File 'lib/snaptrade/api/reference_data_api.rb', line 927

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



947
948
949
950
951
952
# File 'lib/snaptrade/api/reference_data_api.rb', line 947

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