OHLC of a pair on all Uniswap versions

Returns DEX trades by token on Ethereum, where side currency smart contract is 0xc02a…6cc2, currency smart contract is 0x2653…cc3e and DEX protocol name is uniswap_v3, uniswap_v2 or 1 more, sorted by block time: block time, quantile of trade price in USD, average of trade price in USD and sum of trade side amount in USD.

By Divyasshree · saved 29 July 2025 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query tradingViewPairs($network: evm_network, $dataset: dataset_arg_enum, $interval: Int, $token: String, $base: String, $from: DateTime, $to: 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, Dex: {ProtocolName: {in: ["uniswap_v3", "uniswap_v2", "uniswap_v1"]}}}, Block: {Time: {since: $from, till: $to}}}
    ) {
      Block {
        Time(interval: {count: $interval, 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)
    }
  }
}

Variables

{
  "network": "eth",
  "base": "0x2653cd00ceb854efb65b1bb4cbf19c760f66cc3e",
  "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "time_ago": "2025-07-26T06:40:37Z",
  "dataset": "realtime",
  "interval": 60,
  "from": "2025-07-26T06:41:38.000Z",
  "to": "2025-07-29T06:41:38.000Z"
}

Similar queries