ohlcv query bsc

Returns DEX trades by token on BNB Chain, where DEX smart contract is 0x6bbc…d636, side currency smart contract is 0x8ac7…580d, 0x55d3…7955 or 2 more and currency smart contract is 0x7130…ad9c, sorted by block time: block time, smart contract, protocol name, protocol family, quantile of trade price in USD, average of trade price in USD and sum of trade side amount in USD.

By gaurav · saved 22 May 2025 · Bitquery API v2

What it returns

Filters

The query

query tradingView($network: evm_network, $dataset: dataset_arg_enum, $interval: Int, $token: String, $usdc: String!, $usdt: String!, $wbnb: String!, $bnb: String!, $from: DateTime, $to: DateTime) {
  EVM(network: $network, dataset: $dataset) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {TransactionStatus: {Success: true}, Trade: {Dex: {SmartContract: {is: "0x6bbc40579ad1bbd243895ca0acb086bb6300d636"}}, Side: {Currency: {SmartContract: {in: [$usdc, $usdt, $wbnb, $bnb]}}}, Currency: {SmartContract: {is: $token}}, Success: true}, Block: {Time: {since: $from, till: $to}}}
    ) {
      Block {
        Time(interval: {count: $interval, in: minutes})
      }
      Trade {
        Dex {
          SmartContract
          ProtocolName
          ProtocolFamily
        }
      }
      min: quantile(of: Trade_PriceInUSD, level: 0.05)
      max: quantile(of: Trade_PriceInUSD, level: 0.95)
      close: average(of: Trade_PriceInUSD)
      open: average(of: Trade_PriceInUSD)
      volume: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Variables

{
  "network": "bsc",
  "token": "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c",
  "bnb": "0x",
  "usdc": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
  "usdt": "0x55d398326f99059ff775485246999027b3197955",
  "wbnb": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "dataset": "realtime",
  "time_ago": "2025-05-19T17:54:55Z",
  "interval": 15,
  "from": "2025-05-22T11:55:58.000Z",
  "to": "2025-05-22T17:55:58.000Z"
}

Similar queries