Module: Cryptocompare::Exchanges

Defined in:
lib/cryptocompare/exchanges.rb

Constant Summary collapse

API_URL =
'https://min-api.cryptocompare.com/data/all/exchanges'

Class Method Summary collapse

Class Method Details

.allObject

Get exchange data, such as cryptocurrencies that each exchange offers, and the supported conversion cryptocurrencies.

Returns

[Hash] Hash of exchanges, cryptocurrencies that each exchange offers, and the supported conversion cryptocurrencies.

Example

Get info for all exchanges.

Cryptocompare::Exchanges.all

Sample response

{
 "Coinbase" => {
    "LTC" => [
       "BTC",
       "USD",
       "EUR"
    ],
    "ETH" => [
       "BTC",
       "USD",
       "EUR"
    ],
    "BTC" => [
       "USD",
       "GBP",
       "EUR",
       "CAD"
    ],
    "BCH" => [
       "USD"
    ]
 },
 ...
}


48
49
50
51
# File 'lib/cryptocompare/exchanges.rb', line 48

def self.all
  api_resp = Faraday.get(API_URL)
  JSON.parse(api_resp.body)
end