volume of a token

Historical data The Trading cube covers real time and roughly the last 30 days. For anything older, rebuild the same numbers from raw trades with DEXTradeByTokens. Datasets: https://docs.bitquery.io/docs/graphql/dataset/archive/ Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retenti

By Kshitij Mahajan · saved 24 June 2026 · run 1 time · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   The Trading cube covers real time and roughly the last 30 days. For
#   anything older, rebuild the same numbers from raw trades with
#   DEXTradeByTokens.
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#
# For more info on the endpoint visit -
# https://docs.bitquery.io/docs/trading/crypto-price-api/introduction/
# For faster results try using indexed feilds in where and orderBy clause -
# https://docs.bitquery.io/docs/graphql/indexed-fields-reference/

{
  TokenAsBase: Trading {
    Pairs(
      where: {Interval: {Time: {Duration: {eq: 1}, Start: {since_relative: {hours_ago: 24}}}}, Price: {IsQuotedInUsd: true}, Token: {Id: {in: ["bid:solana:CZzgUBvxaMLwMhVSLgqJn3npmxoTo6nzMNQPAnwtHF3s", "bid:eth:0xfaf0cee6b20e2aaa4b80748a6af4cd89609a3d78", "bid:bsc:0xfaf0cee6b20e2aaa4b80748a6af4cd89609a3d78", "bid:tron:TXL6rJbvmjD46zeN1JssfgxvSo99qC8MRT"]}}, Market: {Protocol: {notIn: ["jupiter", "dex_solana_v3"]}}}
    ) {
      Token {
        Name
        Symbol
        Id
      }
      Price {
        Average {
          currentPrice: Mean(maximum: Block_Time)
          H1Ago: Mean(
            maximum: Block_Time
            if: {Block: {Time: {till_relative: {hours_ago: 1}}}}
          )
          H4Ago: Mean(
            maximum: Block_Time
            if: {Block: {Time: {till_relative: {hours_ago: 4}}}}
          )
          H24Ago: Mean(
            minimum: Block_Time
            if: {Block: {Time: {after_relative: {hours_ago: 24}}}}
          )
        }
      }
      Price_change_1h: calculate(
        expression: "( ( $Price_Average_currentPrice - $Price_Average_H1Ago ) / $Price_Average_H1Ago ) * 100"
      )
      Price_change_4h: calculate(
        expression: "( ( $Price_Average_currentPrice - $Price_Average_H4Ago ) / $Price_Average_H4Ago ) * 100"
      )
      Price_change_24h: calculate(
        expression: "( ( $Price_Average_currentPrice - $Price_Average_H24Ago ) / $Price_Average_H24Ago ) * 100"
      )
      v1h: sum(of: Volume_Usd, if: {Block: {Time: {since_relative: {hours_ago: 1}}}})
      v4h: sum(of: Volume_Usd, if: {Block: {Time: {since_relative: {hours_ago: 4}}}})
      v24h: sum(of: Volume_Usd)
    }
  }
}

Similar queries