Skip to main content

Crypto Price API: Real-Time Token Prices, OHLC and Market Cap

The Bitquery Crypto Price API returns the price of any token that trades on-chain, not only listed coins: real-time and the last 30 days for Solana, Ethereum, BNB Smart Chain, Base, Arbitrum, Optimism, Polygon, Tron and Robinhood Chain, in USD or against any quote token. Every row carries OHLC for intervals from one second up, mean and moving-average prices, volume, market cap and supply, over GraphQL queries, WebSocket subscriptions and Kafka. Prices are built from DEX trades with outlier filtering, and a cross-chain view aggregates the same asset across networks, so bid:bitcoin returns one Bitcoin price. Every query below runs as written in the Bitquery IDE on a free account; the trial includes complete history. For older candles, use DEXTradeByTokens or the Solana historical page.

Real-time + last ~30 days only

The Crypto Price API cubes (Trading.Tokens, Trading.Currencies, Trading.Pairs) are part of the Trading cube family — built for real-time and the last ~30 days. For OHLC built from raw trades older than ~30 days, use chain-level DEXTradeByTokens instead. See the Trading Data Overview for the side-by-side comparison.

For a product-level overview — supported chains, OHLCV, USD pricing and plans — see the Crypto Price API page.

Bitquery provides Crypto Price APIs and Streams via GraphQL and Kafka. This cryptocurrency price API delivers comprehensive pricing data across multiple blockchains.

These tools let you stream and query aggregated price data in USD or other paired currencies based on time and volume for all tokens across EVM, Solana, Tron, and other supported chains. Our crypto prices api is the main source for real-time pricing and OHLC; for historical OHLC from DEX trades, use DEXTradeByTokens as described in the OHLC documentation.

The Crypto Price API provides more than just pair prices, it also includes OHLCV (K-Line), Simple Moving Averages (SMA), Weighted Moving Averages (WMA), mean prices, and other key price-related statistics. While you can access the aggregated price for a single trading pair, the Price Index also supports cross-chain and cross-DEX aggregation, giving you a unified view of token prices across multiple ecosystems.

OHLC & K-lines: Use this Crypto Price API as the primary source. For historical OHLC (long backfills, archive data, or trade-built candles), use DEXTradeByTokens (see OHLC guide — when to use DEX).

ProductUsing this in production? See the Crypto Price API page for plans, free trial and enterprise delivery options.

Key Features of These APIs

  • Pre-aggregated data: OHLC, SMA, WMA, EMA, and mean prices calculated automatically
  • Real-time streaming: 1-second granularity via GraphQL subscriptions and Kafka
  • Multi-chain support: Ethereum, Solana, BSC, Arbitrum, Base, Optimism, Polygon, Robinhood, and more
  • Clean data: Automatic filtering of low-quality trades and outliers
  • Cross-chain aggregation: Unified view of token prices across multiple ecosystems

List of Supported Networks

  • Arbitrum
  • Base
  • Matic
  • Ethereum
  • Solana
  • Binance Smart Chain
  • Tron
  • Optimism
  • Robinhood
Faster queries: filter with NetworkBid instead of Network

When you scope Tokens, Pairs, or related Trading queries by chain, prefer NetworkBid over the Network field in your where clause for lower latency.

Use the same bid:<chain> convention as Token.Id.

Network NameNetworkBid Value
Solanabid:solana
Ethereumbid:eth
Binance Smart Chainbid:bsc
Basebid:base
Arbitrumbid:arbitrum
Matic (Polygon)bid:matic
Tronbid:tron
Optimismbid:optimism
Robinhoodbid:robinhood

Available Endpoints

Quick Start

Pricing one specific token? Start with Pairs + rank 1

The stream below is a firehose of every token on every chain, and the Tokens cube is the right choice for it. If instead you want the price of one token, query the Pairs cube with Ranking: { Position: { eq: 1 } } — it returns the price from the token's top market rather than a blend across all of its pools, which matters for tokens with fragmented liquidity.

Run Stream >

Note: A Volume: {Usd: {gt: 5}} filter is applied to remove extreme outliers; the price stream already pre-filters outliers—this is an additional check.

subscription {
Trading {
Tokens(
where: {
Interval: { Time: { Duration: { eq: 1 } } }
Volume: { Usd: { gt: 5 } }
}
) {
Token {
Address
Id
IsNative
Name
Network
Symbol
TokenId
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Base
Quote
Usd
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
}
}
}

What is the Crypto Price API (Price Index) and Why Does It Matter?

The Crypto price API/Stream (Price Index) provides real-time, aggregated price data with ultra-low latency across multiple trading pairs, tokens, decentralized exchanges (DEXs), and blockchains. It's the first product of its kind, designed to help developers access accurate, up-to-the-second prices for building financial applications. This real-time crypto price API delivers multi-chain cryptocurrency price data essential for trading bots, DeFi protocols, and blockchain price feed applications. Whether you're looking for a free crypto price api for development or production-grade pricing data, our platform offers flexible access to comprehensive market data.

Data Processing Pipeline

  1. Data Ingestion: Onchain data is collected and parsed from supported DEXs across all chains
  2. Quality Filtering: Trades with zero amount or below decimal precision (e.g. < 10^decimals/10,000) are filtered out. See Price Index Algorithm for details.
  3. Aggregation: Price data is aggregated by time intervals (1s, 3s, 5s, etc.) and volume thresholds
  4. Metric Calculation: OHLC, moving averages, and other statistical measures are pre-calculated
  5. Distribution: Data is made available via GraphQL subscriptions and Kafka streams

This API serves as the foundational layer of our trading-focused data suite, designed to provide developers with accurate, up-to-the-second prices for building financial applications.

Technical Specifications

Data Format

  • Response Format: GraphQL JSON or Protobuf ( For Kafka)
  • Streaming Protocol: WebSocket (GraphQL subscriptions) or Kafka Stream in Protobuf
  • Update Frequency: Real-time with 1-second granularity
  • Data Retention: Rolling ~30 days of historical data available for querying; older history via chain-level DEXTradeByTokens

Supported Price Metrics

  • OHLC: Open, High, Low, Close prices
  • Moving Averages: Simple (SMA), Weighted (WMA), Exponential (EMA)
  • Volume: Base token, Quote token, USD equivalent
  • Price Statistics: Mean, median, weighted average

Supported Supply Metrics

  • Market Cap
  • Fully Diluted Valuation Usd
  • Circulating Supply
  • Total Supply
  • Max Supply

Moving Average Calculation Window

All moving averages (Simple Moving Average, Weighted Moving Average, and Exponential Moving Average) use a window size of 5 entries for calculation, regardless of the time interval:

  • 1-second interval: 5 entries of 1 second each
  • 60-second interval: 5 entries of 60 seconds each
  • 3600-second interval: 5 entries of 3600 seconds (1 hour) each

This consistent window size ensures comparable moving average calculations across all time intervals.

Accessing the API

Crypto Price API stream with pre-calculated OHLC in the response

This stream has pre-calculated OHLC data in the response which you can feed directly to your charting solution without additional calculations. Our cryptocurrency price api is accessible through GraphQL queries and subscriptions, making it easy to integrate into your applications. The crypto prices api supports real-time streaming and recent OHLC history (rolling 30 days); for older OHLC, use DEXTradeByTokens as in the OHLC guide.

Note: Most queries can be converted to a GraphQL stream (WebSocket) by changing the keyword query to subscription. Trading cube queries are the exception — selectWhere, if, most statistical metrics and interval: do not survive the conversion, and calculate behaves differently. See What does not survive streaming.

Kafka Topic for Crypto Price Stream: trading.prices

This Kafka topic delivers real-time, pre-aggregated price data for tokens, currencies, and trading pairs across all supported blockchains. The data structure is a combination of all 3 cubes described in next section.

Schema for the proto topic is here. The python package and npm package already have all schema updated.

Each message contains:

  • Price metrics – OHLC (Open, High, Low, Close), Mean Price, SMA, WMA, EMA in USD
  • Volume data – Base, Quote, and Base in USD
  • Supply data – currency-level MarketCap, FullyDilutedValuationUsd, CirculatingSupply, TotalSupply, and MaxSupply (Supply fields reference)
  • Interval-based aggregation – fixed durations (1s, 3s, 5s, 10s, etc.)
  • Clean feed – low-quality and outlier trades are filtered automatically for accuracy as per the price algorithm discussed above.

Note on "Quotes":
The "Quotes": [...] section in the Kafka stream shows how much was traded in the native token (e.g., SOL) and how the USD value was derived.
All following price entries (MeanPrice, SMA, OHLC, etc.) are already expressed in USD and ready for direct use in charting, bots, or analytics.

Cubes in the API

The Price APIs have three core data cubes:

  • Tokens: One blended price per token per chain, aggregated across every pool the token trades in. Use it for chain-wide streams and per-chain aggregates.
  • Currencies: An aggregated view of tokens that represent the same underlying asset. For example, tokens like cbBTC, WBTC, and other Bitcoin-wrapped tokens are all grouped under the Bitcoin currency.
  • Pairs: Price and volume data for token pairs on specific markets/protocols. E.g., SOL/USDC on Raydium (Solana) or ETH/USDT on Uniswap (Ethereum). This is also the recommended cube for a specific token's price — filter to its top market with Ranking: { Position: { eq: 1 } }.

Note: Expressions are supported in this API.

Currencies

Currencies are representation of all tokens on various chains supported in Crypto Price API(Price Index). For example, take the case of Bitcoin, while it is a native token on Bitcoin chain, it is also traded on EVM chains as WBTC ( wrapped BTC). Now all these representations of BTC are represented as a single currency.

Note: We include Volume: {Usd: {gt: 5}} to further remove extreme outliers; the stream already pre-filters outliers—this is an additional check.

{
Trading {
Currencies(
limit: { count: 1 }
orderBy: { descending: Block_Time }
where: {
Currency: { Id: { is: "bid:bitcoin" } }
Volume: { Usd: { gt: 5 } }
}
) {
Volume {
Usd
Quote
BaseAttributedToUsd
Base
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
Price {
Ohlc {
Open
Low
High
Close
}
IsQuotedInUsd
Average {
Mean
WeightedSimpleMoving
SimpleMoving
ExponentialMoving
}
}
Currency {
Symbol
Name
Id
}
Block {
Timestamp
}
Interval {
Time {
Duration
Start
End
}
}
}
}
}

How does the above query work?

It takes amounts and prices from all chains that use BTC and wrapped versions (including bridged versions) and presents an aggregated view. The OHLC, mean and other values represent a stable BTC picture.

Tokens

Let's say you don't want a chain agnostic view, but want to focus on a particular chain. How to stream or query prices for it? This is where tokens come in.

Note: the price below is blended across all pools where the token is base. For a single token, the rank-1 Pairs query prices it from its top market instead — recommended whenever you care about one specific token.

Note: We include Volume: {Usd: {gt: 5}} to further remove extreme outliers; the stream already pre-filters outliers—this is an additional check.

{
Trading {
Tokens(
where: {
Token: {
Address: { is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }
Network: { is: "Solana" }
}
Interval: { Time: { Duration: { eq: 1 } } }
Volume: { Usd: { gt: 5 } }
}
limit: { count: 1 }
orderBy: { descending: Block_Time }
) {
Token {
Address
Id
IsNative
Name
Network
Symbol
TokenId
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Base
BaseAttributedToUsd
Quote
Usd
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
}
}
}

We filter for specific tokens using the token Address and Network. If you need to stream all token prices on say Solana, simply set Network to solana.

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 {
Tokens(
where: {
Token: { Network: { is: "Solana" } }
Volume: { Usd: { gt: 5 } }
}
) {
Token {
Address
Id
IsNative
Name
Network
Symbol
TokenId
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Base
BaseAttributedToUsd
Quote
Usd
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
}
}
}

Pairs

This is the 3rd cube in these set of APIs. The Pairs cube gives you price, volume, and market-level trading data between two tokens — a base token and a quote token. We will breakdown in detail how base token and Quote are chosen in the next section.

Recommended for single-token prices: add Ranking: { Position: { eq: 1 } } to a Pairs query to get a token's price from its top market — the pool carrying the most volume for it. See Getting the Most Accurate Token Price.

Tip: Use TokenId instead of Token.Address to fetch all variants of the same token (e.g., ETH, WETH, bridged ETH) across multiple 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 {
Pairs(
where: {
Market: { Network: { is: "Base" } }
QuoteToken: {
Address: { is: "0x4200000000000000000000000000000000000006" }
}
Token: { Address: { is: "0x940181a94a35a4569e4529a3cdfb74e38fd98631" } }
Volume: { Usd: { gt: 5 } }
}
) {
Currency {
Symbol
Name
Id
}
Market {
Protocol
Program
Network
Name
Address
}
Token {
Address
Id
Name
Symbol
TokenId
}
Volume {
Usd
Base
Quote
BaseAttributedToUsd
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
QuoteToken {
TokenId
Name
Id
Address
Symbol
}
QuoteCurrency {
Id
}
Price {
Ohlc {
Open
Low
High
Close
}
Average {
WeightedSimpleMoving
SimpleMoving
Mean
ExponentialMoving
}
}
}
}
}

Understanding Intervals

Unlike DEXtrades APIs, the intervals here are fixed and cannot be arbitrary.

Supported Time Intervals

The following durations (in seconds) are supported for querying or streaming historical and real-time data, unlike DEX APIs, these intervals are fixed, other values are not supported.

1, 3, 5, 10, 30, 60, 300, 900, 1800, 3600

Supported Volume Aggregation Levels

Use TargetVolume to get price intervals aggregated over a volume threshold:

1000, 10000, 100000, 1000000 (USD)

When to Choose Which Cube (Token, Currency, Pair)?

The short answer

For the price of a specific token, use Pairs with Ranking: { Position: { eq: 1 } } — see Getting the Most Accurate Token Price. Use Tokens for chain-wide streams and per-chain aggregates, and Currencies for one cross-chain number per asset.

Use the Pairs cube when:

  • You want the price of a specific token — filter to its top market with Ranking: { Position: { eq: 1 } } so thin pools do not affect the number (how and why).
  • You want pair-level trading data (e.g., SOL/USDC, ETH/DAI).
  • You’re analyzing trading activity on a specific market or DEX (e.g., Uniswap, PancakeSwap, Raydium).
  • You need OHLC, volume, liquidity, and market-specific pricing between two tokens.
  • You're exploring price arbitrage or spreads across chains or platforms.

Use the Tokens cube when:

  • You want a firehose of price updates for every token on a chain.

  • You want one chain-wide number per token, blended across all of its pools, rather than the price on a single market.

  • You're interested in aggregate volume across all of a token's pools, or the currency-level Supply and MarketCap fields.

    For a single token's price, prefer Pairs with rank 1: the Tokens price is a volume-weighted blend of every pool, so thin pools can pull it away from the primary market. See Tokens cube.

Use the Currencies cube when:

  • You want a chain-agnostic view of a token (e.g., BTC across Bitcoin, Ethereum (WBTC), Solana, etc.).
  • You need a global price for a currency, combining its various representations.
  • You're looking for aggregated OHLC and average prices for a token across chains.

Crypto Price API for TradingView

With the new Price API, you can simply feed the stream to your custom datafeed object in the TradingView code and have it update charts in real-time.

  • A sample tutorial is available here
  • The stream is available ready-to-chart SDK here. Simply copy paste the advanced charting library into the correct folder, add Bitquery access token and it is ready.

Video Tutorial | Introduction to Crypto Price APIs

Frequently Asked Questions

Is there a free crypto price API?

Yes. A free Bitquery account runs every query on this page in the IDE, and the seven-day trial includes 1,000 API points, 100 MCP credits and two simultaneous streams for use outside it. Plans after that are on the pricing page.

Does the API return Bitcoin and other coin prices, or only tokens?

Both. The Currencies cube aggregates an asset across chains, so Currency.Id bid:bitcoin returns one BTC price in USD; the Tokens and Pairs cubes return per-chain token and pair prices, including tokens no aggregator lists.

How far back does the Crypto Price API go?

The Trading cubes hold real-time data and about the last 30 days. For older OHLC, use DEXTradeByTokens on the archive dataset or cloud datasets; the Solana historical data page walks through it.

Can I get market cap and fully diluted valuation with the price?

Yes. The Tokens cube returns MarketCap, FullyDilutedValuationUsd and CirculatingSupply alongside every price row, and the market cap API page shows the queries.

Which quote currencies are supported?

USD by default, plus any on-chain quote token through the Pairs cube, which returns the price of a token against the token it trades with, such as USDC, WETH or SOL.

How do I get real-time crypto prices and OHLC candles?

Use Trading.Tokens, Trading.Pairs, or Trading.Currencies for aggregated USD prices and OHLC over the last ~30 days. For older history, build candles from DEXTradeByTokens on the chain you need.

Which cube gives the most accurate price for a specific token?

Trading.Pairs filtered with Ranking: { Position: { eq: 1 } }. That returns the price on the token's top market — the pool contributing the most volume — instead of the Tokens cube's blend across every pool, which thin pools can pull off the primary market's price. See Getting the Most Accurate Token Price on the Pairs cube page.

What is the difference between Crypto Price API and Crypto Trades API?

Crypto Price API gives aggregated price feeds and OHLC by token or pair. Crypto Trades API returns individual swap rows with USD price, market cap, and supply on every trade.

Which blockchains are supported?

Major EVM chains, Solana, Tron, and others in the Trading cube. Filter by network in your query — see the Trading Data Overview for the full list.

Can I stream live price updates to a chart or bot?

Yes. Use GraphQL subscriptions, Kafka price-index protobuf topics, or the TradingView SDK linked above for ready-to-chart feeds.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.