Skip to main content

Set up your API key

Build faster with AI

TL;DR
Use /simple/price for spot prices, /coins/{id}/ohlc for candlestick charts, /coins/{id}/market_chart/range for backtesting, and the onchain OHLCV endpoints for sub-minute DEX data.
Replace YOUR_API_KEY in the examples below with your actual key. Get one here →

CEX Trading Workflow

1

Screen assets — /coins/markets

Scan the market to find what to trade. Returns bulk data for ranking by volume, price change, or market cap.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=volume_desc&per_page=50&price_change_percentage=1h,24h,7d" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coins Markets →
Key paramUse
ordervolume_desc surfaces the most liquid assets
price_change_percentage1h,24h,7d for multi-timeframe momentum
per_pageUp to 250 per page
2

Monitor prices — /simple/price

Poll spot prices for your selected assets. Minimal overhead — ideal for trading loops.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd&include_24hr_vol=true&include_24hr_change=true" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Simple Price →
{
  "bitcoin": {
    "usd": 67432.51,
    "usd_24h_vol": 28394567890.12,
    "usd_24h_change": 2.34
  }
}
For onchain tokens not listed on CoinGecko, use Onchain Simple Price — returns prices by contract address on any supported network.
3

Analyze charts — /coins/{id}/ohlc

Fetch OHLC candles for technical analysis (RSI, MACD, Bollinger Bands, etc.).
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/bitcoin/ohlc?vs_currency=usd&days=30" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coin OHLC →
Response format: [timestamp, open, high, low, close] — timestamp is the candle close time.
Auto-granularity based on days:
  • 1–2 days → 30-min candles
  • 3–30 days → 4-hour candles
  • 31+ days → 4-day candles
Paid plans can override with interval=daily or interval=hourly.
4

Find execution venue — /coins/{id}/tickers

Compare trading pairs across CEXs and DEXs — bid/ask spreads, volume, and market depth.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/bitcoin/tickers?exchange_ids=binance,coinbase&depth=true&order=volume_desc" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Coin Tickers →
Key paramUse
exchange_idsFilter to exchanges you trade on
depthIncludes cost_to_move_up_usd / cost_to_move_down_usd — how much capital moves price 2%
5

Backtest — /coins/{id}/ohlc/range or /market_chart/range

Pull historical data for a specific time window.
  • OHLC candles for a custom range:
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/bitcoin/ohlc/range?vs_currency=usd&from=2024-01-01&to=2024-06-30&interval=daily" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
OHLC Range →
  • Price + volume + market cap for a custom range:
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/coins/ethereum/market_chart/range?vs_currency=usd&from=2024-01-01&to=2024-12-31" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Market Chart Range →
Both accept ISO dates and UNIX timestamps for from/to.

Onchain DEX Trading

For DeFi-native strategies — pool-level OHLCV with sub-minute granularity and individual trade feeds.
1

Pool OHLCV — sub-minute candles

Supports second, minute, hour, and day timeframes with customizable aggregation (e.g., 5-min candles).
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/onchain/networks/eth/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv/minute?aggregate=5&limit=100&currency=usd" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Pool OHLCV → | Token OHLCV →
Response format: [timestamp, open, high, low, close, volume].
Key paramUse
aggregateCombine candles — 5 for 5-min, 4 for 4-hour
limitUp to 1000 data points
before_timestampPaginate backward for historical data
currencyusd for fiat or token for base-token denomination
2

Trade feed — last 300 trades

Monitor execution, analyze microstructure, or trigger alerts on large swaps.
curl -X GET \
  "https://pro-api.coingecko.com/api/v3/onchain/networks/eth/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/trades?trade_volume_in_usd_greater_than=10000" \
  -H "x-cg-pro-api-key: YOUR_API_KEY"
Pool Trades → | Token Trades →
Use trade_volume_in_usd_greater_than to filter noise.