CoinGecko API Guide
Public API Pro APIPricing Enterprise
  • Getting Started
    • 🦎Introduction
    • πŸš€Getting Started
    • πŸ”‘Authentication
    • πŸ“”Endpoint Overview
    • πŸ§ͺBest Practices
    • πŸŽ“10-min Tutorial Guide
      • #1: Get Data by ID or Address
      • #2: Get Historical Data
      • #3: Get Exchanges & NFT Data
    • πŸ“ΌEndpoint Demo
    • πŸ”¨Common Use Cases
    • ⚠️Error & Rate Limit
  • Exclusive Endpoints
    • πŸ‘‘Pro-API
    • for Paid Plan subscribers
    • for Enterprise-plan clients
  • Others
    • πŸ’œDEX Data API
    • πŸ•Changelog
    • 🟒API Status
    • πŸ‘©β€πŸ«Tutorials (beginner-friendly)
    • πŸ’ΌCase Studies
    • πŸ•ΈοΈClients (Unofficial)
    • ❓FAQs & Useful Links
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started
  2. 10-min Tutorial Guide

#2: Get Historical Data

We can also get the historical data for analysis or to plot a chart.

Previous#1: Get Data by ID or AddressNext#3: Get Exchanges & NFT Data

Last updated 2 years ago

Was this helpful?

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 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

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

πŸŽ“
epochconverter.com
https://www.coingecko.com/en/api/documentation