Module: Coincap::Exchanges

Defined in:
lib/coincap/exchanges.rb

Overview

The /exchanges endpoint offers an understanding into the where cryptocurrency is being exchanged and offers high-level information on those exchanges.

CoinCap strives to provide transparency in the recency of our exchange data.

For that purpose you will find an “updated” key for each exchange. For more details into coin pairs and volume, see the /markets endpoint.

Constant Summary collapse

URI_API =
"#{BASE_URI}#{VERSION_API}/exchanges"

Class Method Summary collapse

Class Method Details

.listString

Returns a list of all exchanges.

{
  "data": [
    {
      "id": "okex",
      "name": "Okex",
      "rank": "1",
      "percentTotalVolume": "21.379485735166293542000000000000000000",
      "volumeUsd": "616465445.1646260280799955",
      "tradingPairs": "22",
      "socket": false,
      "exchangeUrl": "https://www.okex.com/",
      "updated": 1536343139514
    },
  ...
  ],
  "timestamp": 1536605835421
}

Returns:

  • (String)


37
38
39
# File 'lib/coincap/exchanges.rb', line 37

def self.list
  Helper.request_to_read_data(URI_API)
end

.single(exchange_id) ⇒ String

Returns a single exchange.

{
  "data": {
    "id": "kraken",
    "name": "Kraken",
    "rank": "4",
    "percentTotalVolume": "2.946801735133553120000000000000000000",
    "volumeUsd": "84969370.4499608426167365",
    "tradingPairs": "52",
    "socket": false,
    "exchangeUrl": "https://kraken.com",
    "updated": 1536343139468
  },
  "timestamp": 1536605874069
}

Parameters:

  • exchange_id (String)

    Search by exchange name, for example, kraken

Returns:

  • (String)


60
61
62
# File 'lib/coincap/exchanges.rb', line 60

def self.single(exchange_id)
  Helper.request_to_read_data("#{URI_API}/#{exchange_id}")
end