idan query

Returns DEX trades by token on Base, where side currency smart contract is 0x4200…0006, currency smart contract is 0x768B…0149 and DEX protocol family is Uniswap, sorted by block time: price in USD, quantile of trade price in USD, sum of trade side amount in USD and block time.

By Divyasshree · saved 6 December 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String, $from: DateTime, $to: DateTime) {
  EVM(network: base) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Block: {Time: {after: $from, before: $to}}, Trade: {Dex: {ProtocolFamily: {is: "Uniswap"}}, Side: {AmountInUSD: {gt: "0"}, Currency: {SmartContract: {is: "0x4200000000000000000000000000000000000006"}}, Amount: {gt: "0"}}, Currency: {SmartContract: {is: $token}}, PriceAsymmetry: {le: 0.1}}}
    ) {
      Trade {
        open: PriceInUSD(minimum: Block_Time)
        close: PriceInUSD(maximum: Block_Time)
      }
      high: quantile(of: Trade_PriceInUSD, level: 0.95)
      low: quantile(of: Trade_PriceInUSD, level: 0.05)
      volume: sum(of: Trade_Side_AmountInUSD)
      Block {
        Time(interval: {count: 1, in: minutes})
      }
    }
  }
}

Variables

{
  "token": "0x768BE13e1680b5ebE0024C42c896E3dB59ec0149",
  "from": "2024-12-05T00:27:00Z",
  "to": "2024-12-05T00:28:00Z"
}

Similar queries