TL;DR
Use /simple/price for low-latency spot prices, /coins/{id}/ohlc for candlestick charts, /coins/{id}/market_chart/range for backtesting, and the onchain /ohlcv/{timeframe} endpoints for second-level granularity on DEX pools.Real-time market data is the backbone of any trading system — whether you’re building an automated bot, a custom charting interface, or backtesting a strategy against historical data. This guide walks you through the CoinGecko API endpoints that matter most for trading workflows, and ties them together into a complete workflow at the end:
- Fetching real-time prices for execution logic and portfolio valuation
- Pulling OHLC candle data at multiple granularities for technical analysis
- Accessing historical market data to backtest and validate strategies
- Tracking onchain trades and liquidity for DeFi execution
Navigate the API faster with AI
Install the CoinGecko SKILL to give your AI coding agent built-in knowledge of every endpoint, parameter, and workflow. Setup takes less than 3 minutes.
Endpoint Overview
| Endpoint | What It Gives You | Best For |
|---|---|---|
| /simple/price | Real-time spot prices with optional market cap, volume, and 24h change | Low-latency price feeds for execution logic |
| /coins/markets | Bulk market data for multiple coins in a single call | Screening and ranking assets by volume or price change |
| /coins/{id}/ohlc | Open-High-Low-Close candles | Technical analysis and candlestick charting |
| /coins/{id}/ohlc/range | OHLC candles for a custom date range | Backtesting with precise time windows |
| /coins/{id}/market_chart/range | Price, market cap, and volume over a custom date range | Historical backtesting and trend analysis |
| /coins/{id}/tickers | Trading pairs across CEXs and DEXs with bid/ask and volume | Finding best execution venue |
| /onchain/networks/../pools/../ohlcv/.. | Pool-level OHLCV with minute and second granularity | High-frequency DEX trading strategies |
| /onchain/networks/../pools/../trades | Last 300 trades in the past 24 hours for a pool | Execution monitoring and market microstructure |
Replace
Don’t have one yet? Get your API key here.
YOUR_API_KEY in the examples below with your actual CoinGecko API key.Don’t have one yet? Get your API key here.
Real-Time Prices — /simple/price
🔗 More endpoint details here
The fastest way to get current prices. This endpoint supports querying multiple coins in a single request and returns data with minimal overhead — ideal for polling in a trading loop.
Example request:
| Parameter | Why It Matters |
|---|---|
ids / symbols | Query by CoinGecko ID or ticker symbol — use whichever fits your data model |
vs_currencies | Get prices in multiple fiat or crypto currencies simultaneously |
include_24hr_vol | Essential for volume-weighted execution decisions |
include_24hr_change | Useful for momentum-based strategies |
precision | Control decimal precision to match your system’s requirements |
Market Screening — /coins/markets
🔗 More endpoint details here
When you need to scan across many assets at once — for example, to rank coins by 24h volume or identify top movers — this endpoint returns rich market data in bulk.
Example request:
| Parameter | Why It Matters |
|---|---|
order | Sort by volume_desc to surface the most liquid assets first |
price_change_percentage | Include 1h,24h,7d to spot momentum across multiple timeframes |
per_page | Up to 250 results per page — reduces the number of calls needed |
OHLC Candle Data
/coins/{id}/ohlc
🔗 More endpoint details here
Returns Open-High-Low-Close candle data — the foundation for candlestick charts and most technical indicators (RSI, MACD, Bollinger Bands, etc.).
Example request:
[timestamp, open, high, low, close].The timestamp marks the close time of the candle.
Candle granularity is automatic based on the
days parameter:- 1-2 days: 30-minute candles
- 3-30 days: 4-hour candles
- 31+ days: 4-day candles
interval=daily or interval=hourly:dailyworks for 1, 7, 14, 30, 90, and 180 dayshourlyworks for 1, 7, 14, 30, and 90 days
/coins/{id}/ohlc/range
🔗 More endpoint details here
When you need OHLC data for a specific time window — perfect for backtesting a strategy against a defined period.
Example request:
from and to parameters accept both ISO date strings and UNIX timestamps, giving you flexibility in how you define your backtest window.
Historical Data for Backtesting — /coins/{id}/market_chart/range
🔗 More endpoint details here
Returns price, market cap, and total volume over a custom date range — ideal when your strategy depends on more than just OHLC (e.g., volume-weighted signals or market cap thresholds).
Example request:
Data granularity is automatic based on the date range. Leave the
interval parameter empty for auto granularity, or specify daily or hourly for consistent data points.Cross-Exchange Execution — /coins/{id}/tickers
🔗 More endpoint details here
Shows where a coin is traded and at what price — across both centralized and decentralized exchanges. This is invaluable for finding the best execution venue or identifying arbitrage opportunities.
Example request:
| Parameter | Why It Matters |
|---|---|
exchange_ids | Filter to specific exchanges you actually trade on |
depth | Includes cost-to-move-price (2% bid/ask spread metrics) — critical for large orders |
order | Sort by volume_desc to prioritize the most liquid pairs |
cost_to_move_up_usd and cost_to_move_down_usd fields tell you how much capital it takes to move the price by 2% in either direction — a direct measure of market depth.
Onchain DEX Trading
For DeFi-native strategies, the onchain endpoints provide granular, pool-level data that you won’t find in traditional market data feeds.Pool OHLCV with Sub-Minute Granularity — /onchain/networks/../pools/../ohlcv/..
🔗 More endpoint details here
The Pool OHLCV and Token OHLCV endpoints support day, hour, minute, and second timeframes — with customizable aggregation periods (e.g., 5-minute or 15-minute candles).
Example request (5-minute candles for a Uniswap V3 ETH/USDC pool):
| Parameter | Why It Matters |
|---|---|
timeframe | Choose second, minute, hour, or day |
aggregate | Combine candles (e.g., 5 for 5-minute candles, 4 for 4-hour candles) |
limit | Up to 1000 data points per request |
before_timestamp | Paginate backward in time for historical data |
currency | usd for fiat-denominated or token for base-token denomination |
[timestamp, open, high, low, close, volume].
Onchain Trade Feed — /onchain/networks/../pools/../trades
🔗 More endpoint details here
The Pool Trades endpoint returns the last 300 trades in the past 24 hours for a specific pool — useful for monitoring execution, analyzing market microstructure, or triggering alerts on large swaps.
Example request:
| Parameter | Why It Matters |
|---|---|
trade_volume_in_usd_greater_than | Filter out noise — only see trades above your threshold |
Putting It All Together
Here’s how these endpoints fit into a typical trading workflow:- Screen and select assets — Use
/coins/marketsto rank by volume and momentum - Monitor real-time prices — Poll
/simple/pricefor low-latency price updates - Analyze charts — Fetch
/coins/{id}/ohlcfor technical analysis - Find execution venues — Query
/coins/{id}/tickerswithdepth=truefor best spread and liquidity - Backtest strategies — Pull historical data from
/coins/{id}/ohlc/rangeor/coins/{id}/market_chart/range - Trade onchain — Use onchain OHLCV for sub-minute signals and the trades endpoint for execution monitoring
Integrate with CoinGecko MCP Server
Connect your AI agent directly to CoinGecko’s API using our MCP server — enabling real-time crypto data queries from tools like Claude Desktop, Cursor, and more.
Have feedback or need help? Reach out to
eason.lim@coingecko[dot]com

