Crypto Tokens OHLC Candle K-Line API - Real-Time & Historical Price Data
Get real-time and historical OHLC (Open, High, Low, Close) candle data, K-line charts, and price analytics for crypto tokens across all supported blockchains including Ethereum, Solana, BSC, Polygon, and Tron.
Recommendation: Use the Crypto Price API as your main source for OHLC and K-line data—real-time streams and pre-aggregated bars (low-latency, easy to use). When you need full historical OHLC (deep backfill, archive ranges, or candles built from raw DEX trades), use DEXTradeByTokens on EVM or Solana and aggregate trades into candles—see comparison below.
How do I get OHLCV data for a token using Bitquery?
Use the Crypto Price API first (Trading → Tokens, Pairs, or Currencies): pre-aggregated OHLC, streaming, and intervals such as 1-second and 1-minute, with a clean, multi-DEX index view. For historical OHLC beyond what the Price API covers, switch to DEXTradeByTokens (or chain-specific DEX docs): bucket with Block { Time(interval: { count, in: minutes | hours | days }) } and derive open/high/low/close from PriceInUSD / Trade_Price. See Crypto Price API vs DEXTradeByTokens and the quick table below.
OHLCV & price data — quick answers
| Question | Where to read / run |
|---|---|
| How do I get OHLCV data for a token using Bitquery? | Last 7 Days Crypto Price API ; historical: DEXTradeByTokens OHLC |
| How do I get OHLC in a DEXTradeByTokens query? | DEXTradeByTokens OHLC (for historical OHLC or DEX-level control) |
| How do I get historical OHLCV for a Solana token? | Main OHLC: Crypto Price API — Quick start · Tokens cube · Historical / DEX: Historical OHLCV on Solana · Solana OHLC API |
| How do I get the current price of a token using Bitquery API? | Recommended: Pairs + rank 1 (top market) · Quick start · Examples |
| Which cube gives the most accurate price for one token? | Pairs with Ranking: { Position: { eq: 1 } } — prices from the token's top market rather than a blend across all its pools |
| How do I get price change percentage for a token? | Price change |
| How do I get 1-minute OHLC candles for a DEX pair? | Main: Your first OHLC query (Duration: { eq: 60 }) · Pairs cube · Historical: DEX OHLC pattern |
| How do I get the all-time high (ATH) price of a token? | Solana ATH example |
| Is there an API to get token price in USD on Solana? | Pairs + rank 1 (top market) · Crypto Price API — Quick start · Latest USD (Solana DEX trades) |
| How do I use DEXTradeByTokens vs DEXTrades for OHLCV? | OHLCV: which cube? · DEXTrades cube |
What is OHLC Data?
OHLC (Open, High, Low, Close) data, also known as candlestick or K-line data, is the foundation of technical analysis in cryptocurrency trading. Each OHLC candle represents price movement over a specific time interval:
- Open: The first price recorded in the interval
- High: The highest price reached during the interval
- Low: The lowest price reached during the interval
- Close: The last price recorded in the interval
Our Crypto Price API provides pre-aggregated OHLC data with ultra-low latency—use it as the main source for live charts and typical OHLC needs.
Historical OHLC: For deep history or candles computed from raw DEX trades, use DEXTradeByTokens on EVM or Solana (with dataset: combined or archive as needed).
Getting Started
Quick Start Steps
- Get API Key: Sign up at Bitquery IDE to get your API key
- Choose your method
- GraphQL queries: For one-off APIs
- WebSocket Streams: For real-time data feeds
- Kafka: For high-throughput applications with high degree of relibility
- Select the Right Cube: Choose between Currency, Tokens, or Pairs based on your needs
- Start with Examples: Use our ready-to-run examples below
Your First OHLC Query
Get real-time Bitcoin OHLC data across all chains:
Note: We include
Volume: { Usd: { gt: 5 } }to further remove extreme outliers; the stream already pre-filters outliers—this is an additional check.
subscription {
Trading {
Currencies(
where: {
Currency: { Id: { is: "bid:bitcoin" } },
Interval: { Time: { Duration: { eq: 60 } } },
Volume: { Usd: { gt: 5 } }
}
) {
Currency {
Id
Name
Symbol
}
Price {
Ohlc {
Open
High
Low
Close
}
}
Volume {
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
}
}
}
API Endpoints
- GraphQL Endpoint:
https://streaming.bitquery.io/graphql - Topic:
trading.prices. Please contact sales for a trial username, password.
Why Use Our OHLC API?
Pre-Aggregated Data
- No need to calculate OHLC from raw trade data
- Ready-to-use candlestick data for any time interval
- Optimized for performance and accuracy
- Uses pre-aggregated price data updated in real-time
Multi-Chain Support
- Get OHLC data across all major blockchains
- Chain-agnostic currency views (e.g., Bitcoin across all chains)
- Cross-chain price aggregation
Real-Time Streaming
- WebSocket subscriptions for live OHLC updates
- Kafka streams for high-throughput applications
- Sub-second latency for trading applications
Advanced Analytics
- Moving averages (SMA, WMA, EMA)
- Volume-weighted prices
- Price change calculations
- Technical indicators
Crypto Price API vs DEXTradeByToken
Default for OHLC: Use the Crypto Price API as the primary source for real-time and standard OHLC. Use DEXTradeByTokens when you need full historical OHLC or trade-based aggregation over long ranges.
| Feature | Crypto Price API | DEXTradeByTokens |
|---|---|---|
| Data Availability | Real-time + recent OHLC (Price Index) | Real-time + full historical (with dataset: combined / archive as supported) |
| Data Processing | Pre-aggregated and real time aggregation of price data | Raw trades aggregated on-the-fly in your query |
| Data Quality | Filtered, clean price feed, second level | Trade Level Price |
When to Use Crypto Price API:
- Default for OHLC and K-lines—live streaming and pre-aggregated bars
- Real-time trading applications requiring normalized pricing
- Live charting and dashboards with aggregated price feeds
- High-frequency trading strategies with sub-second updates
- Limit order execution with reliable mark prices
- Futures trading and derivatives pricing
- Lending and borrowing protocols requiring accurate rates
- DeFi applications needing real-time price oracles
- Any application requiring reliable real-time price streams
- Fixed time intervals available due to pre-aggregated data
When to Use DEXTradeByTokens API:
- Historical OHLC and long-range backfills
- When you need actual per-trade detail not only index OHLC
- Full price history, custom intervals, or archive-backed ranges
- Any time interval can be used because aggregation is defined in the query over trades
Supported Time Intervals
Our Crypto Price API OHLC API supports fixed time intervals optimized for different trading strategies:
| Interval | Duration |
|---|---|
| 1 second | 1s |
| 3 seconds | 3s |
| 5 seconds | 5s |
| 10 seconds | 10s |
| 30 seconds | 30s |
| 1 minute | 60s |
| 5 minutes | 300s |
| 15 minutes | 900s |
| 30 minutes | 1800s |
| 1 hour | 3600s |
Volume-Based Aggregation
For volume-driven analysis, we also support volume-based intervals:
- $1,000 USD
- $10,000 USD
- $100,000 USD
- $1,000,000 USD
Choosing the Right Cube for OHLC Data
The Crypto Price API offers three different cubes for accessing OHLC data. Understanding which cube to use is crucial for getting the right data for your specific use case:
Before we dive into the cubes, let's clarify the key terminology:
Currency - The underlying asset (e.g., BTC, ETH, SOL) Token - Specific implementations of a currency on blockchains (e.g., cbBTC, WBTC are Bitcoin tokens) Pair - Trading pairs between two assets (e.g., cbBTC/ETH, WBTC/ETH, WBTC/SOL)
Currency Cube - Chain-Agnostic Aggregated View
Use the Currency cube when you want a unified price view of an asset across all blockchains.
Key Features:
- Aggregates all token representations of the same underlying asset for example for BTC it will combine multiple tokens like WBTC, cbBTC, LBTC etc.
- Can provide both chain specific and chain agnostic prices
- Can provide only USD-quoted prices
- Can combine volume and price data from all chains
Learn more about Currency Cube ➤
Tokens Cube - Chain-Wide Blended Candles
Use the Tokens cube when you want one candle per token per chain, or a stream of candles for every token on a chain.
Key Features:
- Aggregates across all pairs for that token
- Can provide both chain specific and chain agnostic prices
- Can provide only USD-quoted prices
- Can combine volume and price data from all chains
Because the candle blends every pool where the token is base, thin pools contribute to it as well. For candles on one specific token, prefer the Pairs cube with rank 1 (below).
Learn more about Tokens Cube ➤
Pairs Cube - Top Market and Pair-Specific Candles
Use the Pairs cube for OHLC on a specific market — and, with the rank filter, for the most accurate candles on a specific token.
Key Features:
- Recommended for a single token: add
Ranking: { Position: { eq: 1 } }to get candles from the token's top market instead of a blend across all pools (how and why) - Pair-specific OHLC data (e.g., ETH/USDC on Uniswap)
- Can be quoted in USD or quote token
- Market/DEX-specific data
- Most granular level of price data