Solana Token Price API
Get the USD price of any Solana token over GraphQL: the latest price, a live stream, several tokens at once, hourly candles, and the most traded tokens right now. Every query uses the Trading API, which prices each token from its DEX trades and normalizes the result to USD.
For one token, the most accurate price comes from its top market: the pool with the most trading volume, selected with Ranking: { Position: { eq: 1 } }. See why the top market for the details.
To run these queries outside the Bitquery IDE, you need an API access token. How to generate one ➤
The examples use BONK (DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263). Replace it with any SPL token mint address.
Latest price of a Solana token
Returns the latest 1-minute candle of the token's top market. Price.Ohlc.Close is the current USD price.
{
Trading {
Pairs(
where: {
Token: {
Address: { is: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263" }
Network: { is: "Solana" }
}
Ranking: { Position: { eq: 1 } }
Interval: { Time: { Duration: { eq: 60 } } }
Price: { IsQuotedInUsd: true }
}
limit: { count: 1 }
orderBy: { descending: Block_Time }
) {
Token {
Symbol
Address
}
QuoteToken {
Symbol
}
Market {
Protocol
Address
Network
}
Price {
IsQuotedInUsd
Ohlc {
Open
High
Low
Close
}
}
Ranking {
Position
Weight
}
Volume {
Usd
}
Block {
Time
}
}
}
}
Stream a Solana token price in real time
The same filter as a WebSocket subscription, with 1-second intervals. Each message carries the newest price.
subscription {
Trading {
Pairs(
where: {
Token: {
Address: { is: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263" }
Network: { is: "Solana" }
}
Ranking: { Position: { eq: 1 } }
Interval: { Time: { Duration: { eq: 1 } } }
Price: { IsQuotedInUsd: true }
}
) {
Token {
Symbol
Address
}
QuoteToken {
Symbol
}
Market {
Protocol
Address
}
Price {
IsQuotedInUsd
Ohlc {
Close
}
}
Ranking {
Position
Weight
}
}
}
}
The top market can change as volume moves between pools, so read Market.Address from each message instead of assuming a fixed pool.
Prices of several Solana tokens at once
Pass a list of mint addresses. limitBy keeps one row, the newest, per token.
{
Trading {
Pairs(
where: {
Token: {
Address: {
in: [
"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"
"So11111111111111111111111111111111111111112"
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
]
}
Network: { is: "Solana" }
}
Ranking: { Position: { eq: 1 } }
Interval: { Time: { Duration: { eq: 60 } } }
Price: { IsQuotedInUsd: true }
Block: { Time: { since_relative: { minutes_ago: 10 } } }
}
limit: { count: 10 }
limitBy: { by: Token_Id, count: 1 }
orderBy: { descending: Block_Time }
) {
Token {
Symbol
Address
}
QuoteToken {
Symbol
}
Market {
Protocol
}
Price {
Ohlc {
Close
}
}
Ranking {
Position
Weight
}
Block {
Time
}
}
}
}
Hourly OHLC candles for a Solana token
Hourly open, high, low and close for the last 24 hours, with USD volume per hour. Change Duration (in seconds) and hours_ago for other candle sizes and ranges.
{
Trading {
Pairs(
where: {
Token: {
Address: { is: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263" }
Network: { is: "Solana" }
}
Ranking: { Position: { eq: 1 } }
Interval: { Time: { Duration: { eq: 3600 } } }
Price: { IsQuotedInUsd: true }
Block: { Time: { since_relative: { hours_ago: 24 } } }
}
limit: { count: 24 }
orderBy: { descending: Block_Time }
) {
Token { Symbol }
Market { Protocol Address }
Price { Ohlc { Open High Low Close } }
Volume { Usd }
Block { Time }
}
}
}
For more intervals and chart-ready candles, see the OHLC API.
Top Solana tokens by trading volume, with prices
The 10 Solana tokens with the most USD volume in the last hour, with their price. This uses the Tokens cube, which blends every pool a token trades in, which suits a chain-wide list.
{
Trading {
Tokens(
where: {
Token: { Network: { is: "Solana" } }
Interval: { Time: { Duration: { eq: 3600 } } }
Price: { IsQuotedInUsd: true }
Block: { Time: { since_relative: { hours_ago: 1 } } }
}
limit: { count: 10 }
limitBy: { by: Token_Id, count: 1 }
orderBy: { descending: Volume_Usd }
) {
Token { Symbol Name Address }
Price { Average { Estimate } Ohlc { Close } }
Volume { Usd }
Block { Time }
}
}
}
Related
- Pairs cube: all price fields and ranking rules
- Tokens cube: chain-wide prices and volume
- Solana token market cap API
- Solana token supply API
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.