Links

#2: Get Historical Data

We can also get the historical data for analysis or to plot a chart.
Our historical data are queried using and will be returned in UNIX timestamp format.
Tips: if you’re not familiar with UNIX timestamp, you may use tool like epochconverter.com to convert between UNIX timestamp and human readable date
There are 3 different endpoints to get historical data of a coin:
Endpoint
Description
/coins/{id}/history
To get the price & market data of a coin on a specific day in the past (00:00 UTC)
/coins/{id}/market_chart
To get list of historical price & market data of a coin for X days before today.
/coins/{id}/market_chart/range
To get list of historical price & market data of a coin for a date range, between 'from' and 'to'.
​
The data granularity (interval) for market_chart and market_chart/range endpoints is automatic and based on the date range:
  • 1 day from current time = 5-minutely data
  • 1 day from anytime (except from current time) = hourly data
  • 2-90 days from current time or anytime = hourly data
  • above 90 days from current time or anytime = daily data (00:00 UTC)
Let’s try them out on https://www.coingecko.com/en/api/documentation​
​
And yes, you may do so with contract address too:
  • /coins/{id}/contract/{contract_address}/market_chart/
  • /coins/{id}/contract/{contract_address}/market_chart/range