class CoinMarketPro::Endpoint::Exchange
Constants
- ENDPOINT
Public Instance Methods
Returns all static metadata for one or more exchanges including logo and homepage URL.
@param [Hash] args @option args [Array<Integer>] :id @option args [Array<String>] :slug @return [CoinMarketPro::Result] @note At least one “id” or “slug” is required.
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeInfo
# File lib/coin_market_pro/endpoint/exchange.rb, line 19 def info(**args) valid_params?(args) params = convert_params(args) client.get("#{ENDPOINT}/info", options: params.compact).tap do |resp| resp.body = begin resp.body.map { |_k, data| data } rescue StandardError [] end end end
Get a paginated list of all cryptocurrency exchanges with 24 hour volume.
@param args [Hash] @option args [String] :timestamp @option args [Integer] :start @option args [Integer] :limit @option args [String] :convert @option args [String] :sort @option args [String] :sort_dir @option args [String] :market_type Default: 'fees'. Valid values: 'fees', 'no_fees', 'all' @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeListingsLatest
# File lib/coin_market_pro/endpoint/exchange.rb, line 67 def listings(**args) params = convert_params(args) client.get("#{ENDPOINT}/listings/latest", options: params.compact) end
@note This endpoint is not yet available. It is slated for release in early Q4 2018. Get a paginated list of all cryptocurrency exchanges with historical market data for a given point in time.
@param args [Hash] @option args [String] :timestamp @option args [Integer] :start @option args [Integer] :limit @option args [String] :convert @option args [String] :sort @option args [String] :sort_dir @option args [String] :market_type Default: 'fees'. Valid values: 'fees', 'no_fees', 'all' @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeListingsHistorical
# File lib/coin_market_pro/endpoint/exchange.rb, line 48 def listings_historical(**args) params = convert_params(args) client.get("#{ENDPOINT}/listings/historical", options: params.compact) end
Returns a paginated list of all cryptocurrencies by CoinMarketCap ID.
@param [Hash] args @option args [String] :listing_status Optional. Defaults to 'active' @option args [Integer] :start @option args [Integer] :limit @option args [Array] :slug @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeMap
# File lib/coin_market_pro/endpoint/exchange.rb, line 85 def map(**args) params = convert_params(args) client.get("#{ENDPOINT}/map", options: params.compact) end
Get a list of active market pairs for an exchange.
@param [Hash] args @option args [Array<Integer>] :id @option args [Array<String>] :slug @option args [Integer] :start @option args [Integer] :limit @option args [String] :convert @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeMarketpairsLatest
# File lib/coin_market_pro/endpoint/exchange.rb, line 102 def market_pairs(**args) valid_params?(args) params = convert_params(args) client.get("#{ENDPOINT}/market-pairs/latest", options: params.compact).tap do |resp| resp.body = [resp.body] end end
@param [Hash] args @option args [Array<Integer>] :id @option args [Array<String>] :slug @option args [String] :convert @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeQuotesLatest
# File lib/coin_market_pro/endpoint/exchange.rb, line 142 def quotes(**args) valid_params?(args) params = convert_params(args) client.get("#{ENDPOINT}/quotes/latest", options: params.compact).tap do |resp| resp.body = begin resp.body.map { |_k, data| data } rescue StandardError [] end end end
Returns an interval of historic quotes for any exchange based on time and interval parameters.
@param [Hash] args @option args [Array<Integer>] :id @option args [Array<String>] :slug
A single cryptocurrency "id" or "symbol" is required.
@option args [String] :time_period @option args [String] :time_start @option args [String] :time_end @option args [Number] :count @option args [String] :interval @option args [String] :convert @return [CoinMarketPro::Result]
@see pro.coinmarketcap.com/api/v1#operation/getV1ExchangeQuotesHistorical
# File lib/coin_market_pro/endpoint/exchange.rb, line 125 def quotes_historical(**args) valid_params?(args) params = convert_params(args) client.get("#{ENDPOINT}/quotes/historical", options: params.compact).tap do |resp| resp.body = [resp.body] end end
Protected Instance Methods
@param args [Hash] @return [Boolean] @raise [ArgumentError]
# File lib/coin_market_pro/endpoint/exchange.rb, line 162 def valid_params?(args) raise ArgumentError.new('At least one "id" or "slug" is required.') if args[:id].blank? && args[:slug].blank? true end