Buys, Sells, BuyVolume, SellVolume, Makers, TotalTradedVolume, PriceinUSD for a eth pair

Returns DEX trades by token on Ethereum, where DEX smart contract is 0x055F…26a1 or 0x8d34…0A44, side currency smart contract is 0xC02a…6Cc2 and block time since 2025-06-18: currency name, smart contract, currency symbol, price in USD, protocol name, protocol family, side currency symbol and 4 more fields.

By gaurav · saved 18 June 2025 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query MyQuery($network: evm_network, $token: String, $pairAddress: [String!], $min5_timestamp: DateTime, $hr1_timestamp: DateTime) {
  EVM(dataset: realtime, network: $network) {
    DEXTradeByTokens(
      where: {TransactionStatus: {Success: true}, Trade: { Dex: {SmartContract: {in: $pairAddress}}, Side: {Currency: {SmartContract: {is: $token}}}}, Block: {Time: {since: $hr1_timestamp}}}
    ) {
      Trade {
        Currency {
          Name
          SmartContract
          Symbol
        }
        startPrice: PriceInUSD(minimum: Block_Time)
        Price_at_min5: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $min5_timestamp}}}
        )
        current_price: PriceInUSD(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          SmartContract
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract
          }
        }
      }
      makers: count(distinct: Transaction_From)
      makers_5min: count(
        distinct: Transaction_From
        if: {Block: {Time: {after: $min5_timestamp}}}
      )
      buyers: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      buyers_5min: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
      )
      sellers: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sellers_5min: count(
        distinct: Transaction_From
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
      )
      trades: count
      trades_5min: count(if: {Block: {Time: {after: $min5_timestamp}}})
      traded_volume: sum(of: Trade_Side_AmountInUSD)
      traded_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after: $min5_timestamp}}}
      )
      buy_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      buy_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
      )
      sell_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sell_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
      )
      buys: count(if: {Trade: {Side: {Type: {is: sell}}}})
      buys_5min: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after: $min5_timestamp}}}
      )
      sells: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sells_5min: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $min5_timestamp}}}
      )
    }
  }
}

Variables

{
  "network": "eth",
  "token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "pairAddress": ["0x055FB841Cce69000FBAFF2691Ad39Fa6E23826a1","0x8d345583C9289D69d4a55797CcadC5A1eA150A44"],
  "hr1_timestamp": "2025-06-18T07:34:00Z",
  "min5_timestamp": "2025-06-18T08:28:00Z"
}

Similar queries