Price change 5min 1hr, 6hr precentage of a specific token

Historical data This query uses the realtime dataset (the default), which holds only a recent window - hours to days depending on the cube. For older data add a dataset to the top-level element: Solana(dataset: combined) archive full history combined archive + realtime in one result Archive and c

By Akshat · saved 9 December 2025 · run 27 times · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   This query uses the realtime dataset (the default), which holds only a
#   recent window - hours to days depending on the cube.
#
#   For older data add a dataset to the top-level element:
#
#     Solana(dataset: combined)
#
#     archive   full history
#     combined  archive + realtime in one result
#
#   Archive and combined need the historical data add-on:
#   https://bitquery.io/pricing
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#

query MyQuery {
  Solana {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}, Market: {MarketAddress: {is: "Czfq3xZZDmsdGdUyrNLtRhGc47cXcZtLG4crryfu44zE"}}}, Block: {Time: {since_relative: {hours_ago: 6}}}}
    ) {
      Trade {
        Price_5min_ago: PriceInUSD(minimum:Block_Time if:{Block:{Time:{since_relative:{minutes_ago:5}}}})
				Price_1h_ago: PriceInUSD(minimum:Block_Time if:{Block:{Time:{since_relative:{hours_ago:1}}}})
        Price_6h_ago: PriceInUSD(minimum: Block_Time)
        CurrentPrice: PriceInUSD(maximum: Block_Time)
      }
      volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {since_relative: {minutes_ago: 5}}}}
      )
      volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {since_relative: {hours_ago: 1}}}}
      )
      volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {since_relative: {hours_ago: 6}}}}
      )
      Price_Change_5min: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_5min_ago) / $Trade_Price_5min_ago) * 100")
      Price_Change_1h: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_1h_ago) / $Trade_Price_1h_ago) * 100")
      Price_Change_6h: calculate(expression: "(($Trade_CurrentPrice - $Trade_Price_6h_ago) / $Trade_Price_6h_ago) * 100")
    }
  }
}

Similar queries