Why is the price in the markets endpoint vs the market_chart endpoint different?

82 Views Asked by At

Markets endpoint:

https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin

current_price 22105

Market chart endpoint:

https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=7&interval=daily

The last value in the prices array:

22047.831234213034

Both called less than a second apart. Both different prices.

Is it not possible to get the most recent current price from the market_chart endpoint? I'm getting rate limited really fast when I make both calls on 1 screen with the free api.

1

There are 1 best solutions below

0
sachiew On

The endpoints have different caching/update frequency.

As stated here in the CoinGecko API guidebook, this seems to be the best & fastest endpoint to get the latest price: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd