TestMin

Returns DEX trades by token on Ethereum, where side currency smart contract is 0xc02a…6cc2, currency smart contract is 0x1f98…F984 and block time since 2025-01-10, sorted by block time: block time, price in USD, trade price, quantile of trade price in USD, median of trade price in USD, count and sum of trade side amount in USD.

By Sebastian · saved 13 January 2025 · run 30 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: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Currency: {SmartContract: {is: $base}}}, Block: {Time: {since: $time_ago}}, Transaction: {}, TransactionStatus: {Success: true}}
    ) {
      Block {
        Time(interval: {count: $interval, in: minutes})
      }
      Trade {
        open: PriceInUSD(minimum: Block_Number)
        close: PriceInUSD(maximum: Block_Number)
        low: PriceInUSD(minimum: Trade_PriceInUSD)
        minEth: Price(minimum: Trade_Price)
      	high: PriceInUSD(maximum: Trade_PriceInUSD)
      }
      minQ: quantile(of: Trade_PriceInUSD, level: 0.1)
      maxQ: quantile(of: Trade_PriceInUSD, level: 0.9)
      average: median(of: Trade_PriceInUSD)
      
      count
    
      volume: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Variables

{
  "network": "eth",
  "base": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
  "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "time_ago": "2025-01-10T08:41:32Z",
  "dataset": "combined",
  "interval": 60
}

Similar queries