Module: CoingeckoRuby::Client::Categories

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

Instance Method Summary collapse

Instance Method Details

#asset_platformsArray<Hash>

Fetches the list of asset platforms (e.g. Ethereum, OpenLedger, Counterpart) listed in CoinGecko.

Examples:

Get all asset platforms.

client.asset_platforms

Sample response object

[
  {"id"=>"factom", "chain_identifier"=>nil, "name"=>"Factom", "shortname"=>""},
  {"id"=>"openledger",
   "chain_identifier"=>nil,
   "name"=>"OpenLedger",
   "shortname"=>""}
]

Returns:

  • (Array<Hash>)

    each asset platform’s id, name, short name, and chain identifier



75
76
77
# File 'lib/coingecko_ruby/client/categories.rb', line 75

def asset_platforms
  get 'asset_platforms'
end

#categoriesArray<Hash>

Fetches the list of coin categories in CoinGecko.

Examples:

Get all coin categories.

client.categories

Sample response object

[{
  "category_id" => "recently_added",
  "name" => "Recently Added"
}, {
  "category_id" => "aave-tokens",
  "name" => "Aave Tokens"
}]

Returns:

  • (Array<Hash>)

    each category’s id and name



18
19
20
# File 'lib/coingecko_ruby/client/categories.rb', line 18

def categories
  get 'coins/categories/list'
end

#categories_with_market_dataArray<Hash>

Fetches the list of coin categories with its respective market data.

Examples:

Get all coin categories with market data.

client.categories_with_market_data

Sample response object

[
  {
    "id" => "exchange-based-tokens",
    "name" => "Exchange-based Tokens",
    "market_cap" => 169371736001.31586,
    "market_cap_change_24h" => -0.0922414270544203,
    "volume_24h" => 15951052818.441586,
    "updated_at" => "2021-05-16T08:20:23.151Z"
  },
  {
    "id" => "decentralized-finance-defi",
    "name" => "Decentralized Finance (DeFi)",
    "market_cap" => 136820578041.49733,
    "market_cap_change_24h" => -0.9466181422841903,
    "volume_24h" => 14287923081.250826,
    "updated_at" => "2021-05-16T08:20:20.877Z"
  }
]

Returns:

  • (Array<Hash>)

    each category’s id, name, and market data



52
53
54
# File 'lib/coingecko_ruby/client/categories.rb', line 52

def categories_with_market_data
  get 'coins/categories'
end

#get_asset_platformsObject

Deprecated.

Use #asset_platforms instead



80
81
82
# File 'lib/coingecko_ruby/client/categories.rb', line 80

def get_asset_platforms
  asset_platforms
end

#get_categoriesObject

Deprecated.

Use #categories instead



23
24
25
# File 'lib/coingecko_ruby/client/categories.rb', line 23

def get_categories
  categories
end

#get_categories_with_market_dataObject

Deprecated.


57
58
59
# File 'lib/coingecko_ruby/client/categories.rb', line 57

def get_categories_with_market_data
  categories_with_market_data
end