Get a Token's Historical and Current Price by Date

Fetch the historical and current price of a token by entering a specific date and time. Ideal for tracking price changes over time.

By CJ · saved 16 June 2025 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query GetTokenPrice($token: String!, $from: DateTime) {
  Solana {
    DEXTradeByTokens(
      where: {
        Transaction: {Result: {Success: true}},
        Trade: {
          Currency: {MintAddress: {is: $token}},
          Dex: {ProtocolName: {in: ["pump", "pump_amm", "amm_v3", "jupiter"]}}
        },
        Block: {Time: {since: $from}}
      },
      orderBy: {descendingByField: "traded_volume"},
      limit: {count: 1}
    ) {
      Trade {
        Currency {
          Symbol
          Name
          MintAddress
        }
        lastPriceUSD: PriceInUSD(maximum: Block_Slot)
        prePriceUSD: PriceInUSD(
          minimum: Block_Slot
          if: {Block: {Time: {after: $from}}}
        )
      }
      traded_volume: sum(of: Trade_Side_AmountInUSD)
      trades: count
    }
  }
}

Variables

{
    "token": "HmjJLAXm4Q4cWEcFx7sjDtuGujLJeeRAm9MWLhuHpump",
    "from": "2025-06-16T09:00:00Z"
}

Similar queries