BSC OHLC API For Token Pair

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: EVM(network: bsc, dataset: combined) archive full history combined archive + realtime in one result Ar

By Divyasshree · saved 15 October 2025 · run 1 time · 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:
#
#     EVM(network: bsc, 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 tradingViewPairs {
  EVM(network: bsc, dataset: realtime) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {TransactionStatus: {Success: true}, Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: "0x55d398326f99059ff775485246999027b3197955"}}}, Currency: {SmartContract: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}}, Success: true}}
      limit: {count: 10}
    ) {
      Block {
        Time(interval: {count: 60, in: seconds})
      }
      min: quantile(of: Trade_PriceInUSD, level: 0.1)
      max: quantile(of: Trade_PriceInUSD, level: 0.9)
      close: average(of: Trade_PriceInUSD)
      open: average(of: Trade_PriceInUSD)
      volume: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Similar queries