Working Query

BSC Pancake V2 OHLC data

Returns DEX trades by token on BNB Chain, where side currency smart contract is 0xbb4c…095c, currency smart contract is 0x0e09…ce82 and block time since 2025-06-17, sorted by block time: block time, quantile of trade price in USD, price in USD and sum of trade side amount in USD.

By Crypto Botnics · saved 18 June 2025 · run 4 times · Bitquery API v2

What it returns

Filters

The query

query tradingViewPairs($network: evm_network, $dataset: dataset_arg_enum, $interval: Int, $token: String, $base: String, $time_ago: DateTime) {
  EVM(network: $network, dataset: $dataset) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {TransactionStatus: {Success: true}, Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Currency: {SmartContract: {is: $base}}, Success: true}, Block: {Time: {since: $time_ago}}}
    ) {
      Block {
        Time(interval: {count: $interval, in: hours})
      }
      low: quantile(of: Trade_PriceInUSD, level: 0.1)
      high: quantile(of: Trade_PriceInUSD, level: 0.9)
      open: Trade {
        PriceInUSD(minimum: Block_Time)
      }
      close: Trade {
        PriceInUSD(maximum: Block_Time)
      }
      volume: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Variables

{
  "network": "bsc",
  "base": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
  "token": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "time_ago": "2025-06-17T08:12:13Z",
  "dataset": "combined",
  "interval": 1
}

Similar queries