Skip to main content

Crypto Market Cap API

What it is​

Every row of the Crypto Price API carries a Supply object: MarketCap, FullyDilutedValuationUsd, CirculatingSupply, TotalSupply and MaxSupply. It is on Trading.Currencies, Trading.Tokens and Trading.Pairs, next to the price and volume of that row.

Query it for one token, rank a chain by it, or stream it over GraphQL subscriptions or the trading.prices Kafka topic. This page is a FAQ of runnable queries; field semantics are in the Supply fields reference.

How to get it​

Cube. Tokens for a token on one chain, Currencies for the asset across chains. Pairs rows carry the same currency-level Supply, so a pool query gets market cap for free.

Filters. Token: { Address, Network } or Currency: { Id } to pick the asset; Interval: { Time: { Duration: { eq: ... } } } always (without it every row repeats at ten durations); Volume: { Usd: { gt: ... } } to drop dead tokens from rankings.

Streaming. Put subscription in place of query on any example that has no selectWhere, if or interval: argument. Kafka: Multi-Chain Trading Data Streams.

How do I get the USD market cap of a single token?​

Set the token address and read Supply.MarketCap from the latest row.

Run query ➤

{
Trading {
Tokens(
where: {
Token: {
Address: { is: "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn" }
}
Interval: { Time: { Duration: { eq: 1 } } }
}
limit: { count: 1 }
orderBy: { descending: Block_Time }
) {
Token {
Address
Id
IsNative
Name
Network
Symbol
TokenId
}
Block {
Date
Time
Timestamp
}
Interval {
Time {
Start
Duration
End
}
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
Supply {
TotalSupply
MarketCap
FullyDilutedValuationUsd
}
}
}
}
  • Supply is a currency-level figure: the same value appears on every row and every pool of that token.
  • When CirculatingSupply is unknown, MarketCap equals FullyDilutedValuationUsd.

How it is derived​

MarketCap is Price.Average.Estimate x CirculatingSupply; FullyDilutedValuationUsd is Price.Average.Estimate x TotalSupply, and both fall back to the FDV figure when circulating supply is unknown. How Estimate itself is blended from pools is in the Price Index Algorithm; the supply sources and their gaps are in the Supply fields reference.

Examples​

How do I list top tokens by market cap on a blockchain?​

Top Solana tokens by MarketCap, one row per token, with a $1,000 volume floor. Change or remove Network for another chain or all chains.

Run query ➤

{
Trading {
Tokens(
limit: { count: 50 }
limitBy: { count: 1, by: Token_Id }
orderBy: { descending: Supply_MarketCap }
where: {
Interval: { Time: { Duration: { eq: 1 } } }
Volume: { Usd: { gt: 1000 } }
Token: { Network: { is: "Solana" } }
Block: { Time: { since_relative: { hours_ago: 1 } } }
}
) {
Currency {
Id
Name
Symbol
}
Price {
Average {
Mean(maximum: Block_Time)
}
}
Volume {
Base(maximum: Block_Time)
Quote(maximum: Block_Time)
Usd(maximum: Block_Time)
}
Token {
Network
Symbol
Address
}
Supply {
MarketCap(maximum: Block_Time)
FullyDilutedValuationUsd(maximum: Block_Time)
TotalSupply(maximum: Block_Time)
}
}
}
}
  • The 1-hour since_relative window keeps the scan small; widen it if a token you expect is missing.
  • maximum: Block_Time picks the latest row for each token.

How do I query total supply and circulating supply for a cryptocurrency?​

Set a currency id on Currencies and read the Supply fields.

{
Trading {
Currencies(
limit: { count: 1 }
orderBy: { descending: Block_Time }
where: {
Currency: { Id: { is: "pump" } }
Interval: { Time: { Duration: { eq: 60 } } }
}
) {
Currency {
Id
Name
Symbol
}
Supply {
TotalSupply
CirculatingSupply
MaxSupply
MarketCap
FullyDilutedValuationUsd
}
}
}
}
  • CirculatingSupply and MaxSupply are often 0 or null for meme tokens; TotalSupply comes from on-chain supply.

How do I rank tokens by 1-hour market cap change?​

Set the network and a 1-hour interval and sort on the change_mcap expression.

Run query ➤

{
Trading {
Tokens(
limit: { count: 50 }
orderBy: { descendingByField: "change_mcap" }
where: {
Interval: { Time: { Duration: { eq: 3600 } } }
Token: { Network: { is: "Solana" } }
}
) {
Currency {
Id
Name
Symbol
}
Token {
Network
Symbol
Address
}
Supply {
MarketCap
FullyDilutedValuationUsd
CirculatingSupply
TotalSupply
MaxSupply
}
change_mcap: calculate(
expression: "($Price_Ohlc_Close-$Price_Ohlc_Open) * Supply_TotalSupply"
)
Price {
Ohlc {
Open
Close
}
}
}
}
}
  • change_mcap is the price move times TotalSupply, i.e. the FDV move in USD. Use Supply_CirculatingSupply for the market-cap move where it is known.

How do I stream aggregated OHLC and market cap for all tokens on one chain?​

Subscribe to Trading.Tokens with a network and an interval for OHLC, volume and Supply of every token on that chain in one feed. Intervals are listed in the OHLC guide.

Run Query

subscription {
Trading {
Tokens(
where: {
Token: { Network: { is: "Solana" } }
Interval: { Time: { Duration: { eq: 60 } } }
}
) {
Token {
Id
Symbol
Network
}
Interval {
Time {
Start
Duration
End
}
}
Volume {
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
Price {
Ohlc {
Open
High
Low
Close
}
}
}
}
}

How do I stream OHLC for a token pair across chains?​

Trading.Pairs with Currency and QuoteCurrency ids streams every ETH/USDC market on every chain at the chosen interval.

Run Query

subscription {
Trading {
Pairs(
where: {
Interval: { Time: { Duration: { eq: 1 } } }
Currency: { Id: { is: "bid:eth" } }
QuoteCurrency: { Id: { is: "usdc" } }
}
) {
Token {
Symbol
}
QuoteToken {
Symbol
}
Interval {
Time {
Start
}
}
Volume {
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
Price {
Ohlc {
Open
High
Low
Close
}
}
}
}
}

How do I get 5-minute price change % for high-liquidity tokens?​

Trading.Tokens at 300s, a USD volume floor, and calculate on open/close for the percentage move.

Run Query

{
Trading {
Tokens(
limit: { count: 10 }
orderBy: { descendingByField: "change" }
where: {
Volume: { Usd: { gt: 100000 } }
Interval: { Time: { Duration: { eq: 300 } } }
}
) {
Token {
Address
Did
Id
IsNative
Name
Network
Symbol
TokenId
}
Currency {
Symbol
Id
Name
}
Interval {
VolumeBased
Time {
Start
End
}
}
Volume {
Base
BaseAttributedToUsd
Quote
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
Price {
IsQuotedInUsd
Ohlc {
Close
High
Low
Open
}
Average {
Estimate
ExponentialMoving
Mean
SimpleMoving
WeightedSimpleMoving
}
}
diff: calculate(expression: "Price_Ohlc_Close - Price_Ohlc_Open")
change: calculate(expression: "round(($diff / Price_Ohlc_Open), 3) * 100")
}
}
}

How do I stream trades with USD price, market cap and supply on every row?​

Trading.Trades streams MEV-filtered trades from all ten chains with PriceInUsd and Supply on each row. The chain-level DEXTrades subscriptions below are for per-protocol detail and transaction context.

Run query ➤

subscription {
Trading {
Trades {
Block { Time }
Price
PriceInUsd
AmountsInUsd { Base Quote }
Trader { Address }
Pair {
Token { Symbol Network }
QuoteToken { Symbol }
Market { Protocol Network }
}
}
}
}

How do I subscribe to latest Solana DEX trades in real time?​

Solana { DEXTrades } as a subscription returns each swap with buy/sell legs, USD price and DEX protocol.

Run Query

subscription {
Solana {
DEXTrades {
Block {
Time
Slot
}
Transaction {
Signer
Signature
Index
Result {
Success
}
}
Trade {
Index
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Buy {
Amount
AmountInUSD
Account {
Address
Owner
}
Currency {
MintAddress
Decimals
Symbol
Name
}
Price
PriceInUSD
}
Market {
MarketAddress
}
Sell {
Amount
AmountInUSD
Account {
Address
Owner
}
Currency {
Decimals
Symbol
Name
}
Price
PriceInUSD
}
}
}
}
}

How do I stream Ethereum DEX trades in real time?​

EVM(network: eth) { DEXTrades } streams decoded swaps with transaction, log and buy/sell legs.

Run Query

subscription MyQuery {
EVM(network: eth) {
DEXTrades {
Block {
Time
Number
}
Transaction {
Hash
}
Log {
Index
SmartContract
Signature {
Signature
Name
}
}
Trade {
Sender
Buy {
Buyer
AmountInUSD
Amount
Seller
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
Dex {
SmartContract
ProtocolName
ProtocolVersion
}
Sell {
Buyer
AmountInUSD
Amount
Seller
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
}
}
}
}

How do I stream BSC (PancakeSwap) DEX trades?​

EVM(network: bsc).DEXTrades for PancakeSwap and other BSC fills with block, receipt and trade detail.

Run Query

subscription {
EVM(network: bsc) {
DEXTrades {
Block {
Time
Number
}
Receipt {
ContractAddress
Status
}
TransactionStatus {
Success
}
Log {
Signature {
Name
}
}
Trade {
Dex {
ProtocolName
SmartContract
OwnerAddress
}
Buy {
Amount
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
Sell {
Amount
PriceInUSD
Price
Currency {
Name
Symbol
SmartContract
}
}
}
}
}
}

How do I stream Uniswap v1, v2, and v3 trades on Ethereum?​

Filter DEXTrades on ProtocolName in uniswap_v3, uniswap_v2, uniswap_v1.

Run Query

subscription {
EVM(network: eth) {
DEXTrades(
where: {
Trade: {
Dex: {
ProtocolName: { in: ["uniswap_v3", "uniswap_v2", "uniswap_v1"] }
}
}
}
) {
Block {
Time
}
Trade {
Dex {
ProtocolName
}
Buy {
Amount
Currency {
Symbol
}
}
Sell {
Amount
Currency {
Symbol
}
}
}
}
}
}

How do I stream 1-second OHLC for a specific pair (e.g. BTC/USDT)?​

Trading.Pairs at 1s with base and quote currency ids: OHLC, volume and market cap for every BTC/USDT market.

Run Query

subscription {
Trading {
Pairs(
where: {
Interval: { Time: { Duration: { eq: 1 } } }
Currency: { Id: { is: "bid:bitcoin" } }
QuoteCurrency: { Id: { is: "usdt" } }
}
) {
Market {
Name
Network
Address
}
Token {
Symbol
}
QuoteToken {
Symbol
}
Volume {
Usd
}
Supply {
TotalSupply
FullyDilutedValuationUsd
MarketCap
}
Price {
Ohlc {
Open
High
Low
Close
}
}
}
}
}

How do I find cross-chain price arbitrage for the same pair?​

limitBy on Market_Address returns the latest row per venue for the same currency and quote.

Run Query

{
Trading {
Pairs(
where: {
Currency: {Id: {is: "bid:bitcoin"}}
QuoteCurrency: {Id: {is: "usdt"}}
}
limit: {count: 10}
orderBy: {descending: Block_Time}
limitBy: {by: Market_Address, count: 1}
) {
Currency {
Name
Id
}
Market {
Name
NetworkBid
Network
Address
}
Price {
IsQuotedInUsd
Average {
Mean
}
}
QuoteCurrency {
Id
Symbol
Name
}
QuoteToken {
Symbol
Name
Id
NetworkBid
Network
Did
Address
}
Token {
Name
Id
NetworkBid
}
}
}
}

  • No Duration filter here, so rows can be at any of the ten durations; add one before comparing volumes.

How do I stream second-level Uniswap pair OHLC (K-line)?​

Trading.Pairs filtered on Uniswap protocols at a 1s interval.

Run Query

subscription {
Trading {
Pairs(
where: {Market: {Protocol: {in: ["uniswap_v3", "uniswap_v2"]}}, Interval: {Time: {Duration: {eq: 1}}}}
) {
Currency { Name Id }
Market { Name NetworkBid Network Address }
Price { IsQuotedInUsd Average { Mean } }
QuoteCurrency { Id Symbol Name }
QuoteToken { Symbol Name Id NetworkBid Network Did Address }
Token { Name Id NetworkBid }
}
}
}

How do I stream PancakeSwap v3 liquidity adds on BSC?​

Mint logs on the PancakeSwap v3 position manager contract.

Run Query

subscription {
EVM(network: bsc) {
Events(
orderBy: [
{ descending: Block_Time }
{ descending: Transaction_Index }
{ descending: Log_Index }
]
where: {
Log: { Signature: { Name: { is: "Mint" } } }
Transaction: {
To: { is: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364" }
}
Block: { Time: { since_relative: { hours_ago: 1 } } }
}
) {
Block {
Time
Number
Hash
}
Receipt {
ContractAddress
}
Topics {
Hash
}
TransactionStatus {
Success
}
LogHeader {
Address
Index
Data
}
Transaction {
Hash
From
To
}
Log {
EnterIndex
ExitIndex
Index
LogAfterCallIndex
Pc
SmartContract
Signature {
Name
Signature
}
}
Arguments {
Name
Value {
... on EVM_ABI_Integer_Value_Arg {
integer
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_Boolean_Value_Arg {
bool
}
}
}
}
}
}
  • The since_relative filter is there so the same text also completes when run as a query.

How do I stream PancakeSwap v3 liquidity removals on BSC?​

Same contract, Burn signature.

Run Query

subscription {
EVM(network: bsc) {
Events(
orderBy: [
{ descending: Block_Time }
{ descending: Transaction_Index }
{ descending: Log_Index }
]
where: {
Log: { Signature: { Name: { is: "Burn" } } }
Transaction: {
To: { is: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364" }
}
Block: { Time: { since_relative: { hours_ago: 1 } } }
}
) {
Block {
Time
Number
Hash
}
Receipt {
ContractAddress
}
Topics {
Hash
}
TransactionStatus {
Success
}
LogHeader {
Address
Index
Data
}
Transaction {
Hash
From
To
}
Log {
EnterIndex
ExitIndex
Index
LogAfterCallIndex
Pc
SmartContract
Signature {
Name
Signature
}
}
Arguments {
Name
Value {
... on EVM_ABI_Integer_Value_Arg {
integer
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_Boolean_Value_Arg {
bool
}
}
}
}
}
}

How do I stream Raydium liquidity adds on Solana?​

Solana.DEXPools with Raydium's program and a positive base change.

Run Query

subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
}
}
Base: { ChangeAmount: { gt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

How do I stream Raydium liquidity removals on Solana?​

Same program filter, negative ChangeAmount on the base side.

Run Query

subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
}
}
Base: { ChangeAmount: { lt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

How do I stream Orca Whirlpool liquidity adds on Solana?​

DEXPools filtered on the Orca Whirlpool program with a positive base change.

Run Query

subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
}
Base: { ChangeAmount: { gt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

How do I stream Orca Whirlpool liquidity removals on Solana?​

Orca's program with a negative base change.

Run Query

subscription {
Solana {
DEXPools(
where: {
Pool: {
Dex: {
ProgramAddress: {
is: "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
}
}
Base: { ChangeAmount: { lt: "0" } }
}
}
) {
Pool {
Market {
MarketAddress
BaseCurrency {
MintAddress
Symbol
Name
}
QuoteCurrency {
MintAddress
Symbol
Name
}
}
Dex {
ProtocolFamily
ProtocolName
}
Quote {
PostAmount
PriceInUSD
PostAmountInUSD
}
Base {
ChangeAmount
PostAmount
}
}
}
}
}

How do I query Uniswap Router Burn events (liquidity removed) on Ethereum?​

EVM(network: eth, dataset: realtime).Events for Burn logs in transactions sent to the Uniswap V2 Router.

Run Query

{
EVM(network: eth, dataset: realtime) {
Events(
limit: {count: 100}
where: {Transaction: {To: {is: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d"}}, Log: {Signature: {Name: {in: ["Burn"]}}}}
) {
Transaction { Hash From To }
Block { Number }
Log { Signature { Name } SmartContract }
Transaction { From To Type }
LogHeader { Address Index }
Arguments {
Value {
... on EVM_ABI_Integer_Value_Arg { integer }
... on EVM_ABI_String_Value_Arg { string }
... on EVM_ABI_Address_Value_Arg { address }
... on EVM_ABI_Boolean_Value_Arg { bool }
... on EVM_ABI_Bytes_Value_Arg { hex }
... on EVM_ABI_BigInt_Value_Arg { bigInteger }
}
Name
}
}
}
}

  • Transaction.Type is only served by the realtime dataset; on combined this selection errors.

How do I find addLiquidityETH calls for a token pair on Ethereum?​

EVM(dataset: archive).Calls with Call.Signature.Name addLiquidityETH and argument filters, scoped to one transaction here.

Run Query

query MyQuery {
EVM(dataset: archive, network: eth) {
Calls(
where: {
Transaction: {
Hash: {
is: "0x60ce9acd0053f20092e7871868afe5187c95ff6d7750ad65a8d4ff99a052c357"
}
}
Call: { Signature: { Name: { is: "addLiquidityETH" } } }
Arguments: {
length: { eq: 6 }
includes: [
{
Index: { eq: 0 }
Value: {
Address: { is: "0x9cbc0be914e480beee4014e190fdbfc48ed5a4a8" }
}
}
{
Index: { eq: 3 }
Value: { BigInteger: { ge: "1000000000000000000" } }
}
{ Index: { eq: 5 }, Value: { BigInteger: { ge: "1690878863" } } }
]
}
}
limit: { count: 10 }
) {
Arguments {
Index
Name
Type
Path {
Name
Index
Type
}
Name
Value {
... on EVM_ABI_Bytes_Value_Arg {
hex
}
... on EVM_ABI_BigInt_Value_Arg {
bigInteger
}
... on EVM_ABI_Integer_Value_Arg {
integer
}
... on EVM_ABI_String_Value_Arg {
string
}
... on EVM_ABI_Address_Value_Arg {
address
}
... on EVM_ABI_Boolean_Value_Arg {
bool
}
}
}
Call {
Signature {
Name
Signature
}
}
}
}
}

Pitfalls​

  • No Duration filter means ten rows per timestamp. Rankings and sums come out inflated.
  • Supply is currency-level. Every pool and every chain row of the same asset shows the same supply and market cap.
  • Missing circulating supply collapses MarketCap into FDV. Common for meme tokens; check CirculatingSupply before trusting a cap.
  • Stablecoins carry MarketCap 0 at currency level.
  • bid:bitcoin supply is the on-chain wrapped supply, not Bitcoin's 19.9 M, so its market cap is the wrapped-BTC cap. See Bitcoin and on-chain supply.
  • Chain-wide scans at Duration 1 are heavy. Add a since_relative window as in the top-tokens example.

Use these pages for protocol-specific filters, bonding curves, pool events and full DEX examples that pair with the Trading metrics above.

Solana​

BNB Chain (BSC)​

Ethereum and cross-chain​

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.

On this page