Module: CoingeckoRuby::Client::Indexes

Included in:
CoingeckoRuby::Client
Defined in:
lib/coingecko_ruby/client/indexes.rb

Instance Method Summary collapse

Instance Method Details

#get_indexes(options: {}) ⇒ Object

Deprecated.

Use #indexes instead



36
37
38
# File 'lib/coingecko_ruby/client/indexes.rb', line 36

def get_indexes(options: {})
  indexes(**options)
end

#get_indexes_by_market_and_index(market_id:, index_id:, options: {}) ⇒ Object

Deprecated.


83
84
85
# File 'lib/coingecko_ruby/client/indexes.rb', line 83

def get_indexes_by_market_and_index(market_id:, index_id:, options: {})
  indexes_by_market_and_index(market_id, index_id, **options)
end

#get_indexes_idsObject

Deprecated.

Use #index_ids instead



58
59
60
# File 'lib/coingecko_ruby/client/indexes.rb', line 58

def get_indexes_ids
  index_ids
end

#index_idsArray<Hash>

Fetches the ids of market indexes listed in CoinGecko.

Examples:

Get all market index ids and names.

client.index_ids

Sample response object

[
 {"id"=>"LINK", "name"=>"Bibox (Futures) LINK"},
 {"id"=>"BTC", "name"=>"CME Bitcoin Futures BTC"},
 {"id"=>"XRP", "name"=>"Bibox (Futures) XRP"},
 {"id"=>"ETH", "name"=>"Crypto.com (Futures) ETH"}
]

Returns:

  • (Array<Hash>)

    each index’s id and name.



53
54
55
# File 'lib/coingecko_ruby/client/indexes.rb', line 53

def index_ids
  get 'indexes/list'
end

#indexes(**options) ⇒ Array<Hash>

Fetches the list of market indexes listed in CoinGecko.

Examples:

Get all market indexes.

client.indexes

Sample response object

[
  {"name"=>"CoinFLEX (Futures) DFN",
  "id"=>"DFN",
  "market"=>"CoinFLEX (Futures)",
  "last"=>nil,
  "is_multi_asset_composite"=>nil},
 {"name"=>"Bibox (Futures) LINK",
  "id"=>"LINK",
  "market"=>"Bibox (Futures)",
  "last"=>nil,
  "is_multi_asset_composite"=>nil},
 {"name"=>"CME Bitcoin Futures BTC",
  "id"=>"BTC",
  "market"=>"CME Bitcoin Futures",
  "last"=>nil,
  "is_multi_asset_composite"=>false}
]

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :per_page (Integer) — default: 100

    sets the number of results to return per page.

  • :page (Integer)

    sets the page for results.

Returns:

  • (Array<Hash>)

    each index’s id, name, market name, last done, and whether it’s a multiasset composite index.



31
32
33
# File 'lib/coingecko_ruby/client/indexes.rb', line 31

def indexes(**options)
  get 'indexes', **options
end

#indexes_by_market_and_coin(market_id, coin_id, **options) ⇒ Array<Hash>

Fetches the list of indexes based on the market and index given.

Examples:

Get all BTC indexes in the CME Futures market.

client.indexes_by_market_and_coin(market_id: 'cme_futures', coin_id: 'btc')

Sample response object

{
  "name"=>"CME Bitcoin Futures BTC",
  "market"=>"CME Bitcoin Futures",
  "last"=>nil,
  "is_multi_asset_composite"=>false
}

Parameters:

  • market_id (String)

    filter results by the market id.

  • coin_id (String)

    filter indexes from the given market by the index id.

Returns:

  • (Array<Hash>)

    the index’s name, market, last done, and whether it’s a multiasset composite index.



78
79
80
# File 'lib/coingecko_ruby/client/indexes.rb', line 78

def indexes_by_market_and_coin(market_id, coin_id, **options)
  get "indexes/#{market_id}/#{coin_id}", **options
end