Reputation: 611
I can use this:
https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true&include_market_cap=true
to get:
{"bitcoin":{"usd":47498,"usd_market_cap":902977262894.0303,"usd_24h_change":1.1530010412374174}}
Which includes the total market cap of the given coin but I'm wanting to get it's rank, as in BTC should give '1', ETH would give '2', ADA '7' etc.
Basically all the data I'm after is available through the "markets" API but I can't workout how the get a "market block" for a specific coin.
An example of the URL to deliver the top 4 coins by market cap is:
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=4
Can anyone tell me how to get that data for a specific coin?
Upvotes: 0
Views: 798
Reputation: 4180
I believe you are looking for this:
https://api.coingecko.com/api/v3/coins/bitcoin
Search in the result for: "market_cap_rank":
Upvotes: 1