class CryptoApis::ExchangeRatesApi
Attributes
Public Class Methods
# File lib/crypto_apis/api/exchange_rates_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get Exchange Rate By Asset Symbols Through this endpoint customers can obtain exchange rates by asset symbols. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset symbol. @param from_asset_symbol [String] Defines the base asset symbol to get a rate for. @param to_asset_symbol [String] Defines the relation asset symbol in which the base asset rate will be displayed. @param [Hash] opts the optional parameters @option opts [String] :context In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. @option opts [Integer] :calculation_timestamp Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. @return [GetExchangeRateByAssetSymbolsR]
# File lib/crypto_apis/api/exchange_rates_api.rb, line 30 def get_exchange_rate_by_asset_symbols(from_asset_symbol, to_asset_symbol, opts = {}) data, _status_code, _headers = get_exchange_rate_by_asset_symbols_with_http_info(from_asset_symbol, to_asset_symbol, opts) data end
Get Exchange Rate By Asset Symbols Through this endpoint customers can obtain exchange rates by asset symbols. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset symbol. @param from_asset_symbol [String] Defines the base asset symbol to get a rate for. @param to_asset_symbol [String] Defines the relation asset symbol in which the base asset rate will be displayed. @param [Hash] opts the optional parameters @option opts [String] :context In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. @option opts [Integer] :calculation_timestamp Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. @return [Array<(GetExchangeRateByAssetSymbolsR
, Integer, Hash)>] GetExchangeRateByAssetSymbolsR
data, response status code and response headers
# File lib/crypto_apis/api/exchange_rates_api.rb, line 43 def get_exchange_rate_by_asset_symbols_with_http_info(from_asset_symbol, to_asset_symbol, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExchangeRatesApi.get_exchange_rate_by_asset_symbols ...' end # verify the required parameter 'from_asset_symbol' is set if @api_client.config.client_side_validation && from_asset_symbol.nil? fail ArgumentError, "Missing the required parameter 'from_asset_symbol' when calling ExchangeRatesApi.get_exchange_rate_by_asset_symbols" end # verify the required parameter 'to_asset_symbol' is set if @api_client.config.client_side_validation && to_asset_symbol.nil? fail ArgumentError, "Missing the required parameter 'to_asset_symbol' when calling ExchangeRatesApi.get_exchange_rate_by_asset_symbols" end # resource path local_var_path = '/market-data/exchange-rates/by-symbols/{fromAssetSymbol}/{toAssetSymbol}'.sub('{' + 'fromAssetSymbol' + '}', CGI.escape(from_asset_symbol.to_s)).sub('{' + 'toAssetSymbol' + '}', CGI.escape(to_asset_symbol.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil? query_params[:'calculationTimestamp'] = opts[:'calculation_timestamp'] if !opts[:'calculation_timestamp'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetExchangeRateByAssetSymbolsR' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"ExchangeRatesApi.get_exchange_rate_by_asset_symbols", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ExchangeRatesApi#get_exchange_rate_by_asset_symbols\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Exchange Rate By Assets IDs Through this endpoint customers can obtain exchange rates by asset IDs. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset Reference ID. @param from_asset_id [String] Defines the base asset Reference ID to get a rate for. @param to_asset_id [String] Defines the relation asset Reference ID in which the base asset rate will be displayed. @param [Hash] opts the optional parameters @option opts [String] :context In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. @option opts [Integer] :calculation_timestamp Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. @return [GetExchangeRateByAssetsIDsR]
# File lib/crypto_apis/api/exchange_rates_api.rb, line 105 def get_exchange_rate_by_assets_ids(from_asset_id, to_asset_id, opts = {}) data, _status_code, _headers = get_exchange_rate_by_assets_ids_with_http_info(from_asset_id, to_asset_id, opts) data end
Get Exchange Rate By Assets IDs Through this endpoint customers can obtain exchange rates by asset IDs. The process represents the exchange rate value of a single unit of one asset versus another one. Data is provided per unique asset Reference ID. @param from_asset_id [String] Defines the base asset Reference ID to get a rate for. @param to_asset_id [String] Defines the relation asset Reference ID in which the base asset rate will be displayed. @param [Hash] opts the optional parameters @option opts [String] :context In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user. @option opts [Integer] :calculation_timestamp Defines the time of the market data used to calculate the exchange rate in UNIX Timestamp. @return [Array<(GetExchangeRateByAssetsIDsR
, Integer, Hash)>] GetExchangeRateByAssetsIDsR
data, response status code and response headers
# File lib/crypto_apis/api/exchange_rates_api.rb, line 118 def get_exchange_rate_by_assets_ids_with_http_info(from_asset_id, to_asset_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ExchangeRatesApi.get_exchange_rate_by_assets_ids ...' end # verify the required parameter 'from_asset_id' is set if @api_client.config.client_side_validation && from_asset_id.nil? fail ArgumentError, "Missing the required parameter 'from_asset_id' when calling ExchangeRatesApi.get_exchange_rate_by_assets_ids" end # verify the required parameter 'to_asset_id' is set if @api_client.config.client_side_validation && to_asset_id.nil? fail ArgumentError, "Missing the required parameter 'to_asset_id' when calling ExchangeRatesApi.get_exchange_rate_by_assets_ids" end # resource path local_var_path = '/market-data/exchange-rates/by-asset-ids/{fromAssetId}/{toAssetId}'.sub('{' + 'fromAssetId' + '}', CGI.escape(from_asset_id.to_s)).sub('{' + 'toAssetId' + '}', CGI.escape(to_asset_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil? query_params[:'calculationTimestamp'] = opts[:'calculation_timestamp'] if !opts[:'calculation_timestamp'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetExchangeRateByAssetsIDsR' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"ExchangeRatesApi.get_exchange_rate_by_assets_ids", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ExchangeRatesApi#get_exchange_rate_by_assets_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end