Trade Volume in First X Minutes

Returns DEX trades on Ethereum, where buy currency smart contract is 0xc02a…6cc2, sell currency smart contract is 0x4d55…0d35 and transaction from is not 0xf9cA…BE68: count, sum of trade buy amount and sum of trade sell amount.

By HOD · saved 31 January 2024 · run 3 times · Bitquery API v2

What it returns

Filters

The query

query ($network: evm_network, $token: String!, $token2: String!, $tilltime: DateTime, $mev: String!) {
  EVM(network: $network, dataset: combined) {
    Unique_Buyers: DEXTrades(
      where: {Block: {Time: {since: "2023-09-27T01:00:00Z", till: $tilltime}}, Trade: {Buy: {Currency: {SmartContract: {is: $token}}}, Sell: {Currency: {SmartContract: {is: $token2}}}}, Transaction: {From: {not: $mev}}}
    ) {
      count(distinct: Trade_Buy_Buyer)
    }
    Unique_Sellers: DEXTrades(
      where: {Block: {Time: {since: "2023-09-27T01:00:00Z", till: $tilltime}}, Trade: {Buy: {Currency: {SmartContract: {is: $token}}}, Sell: {Currency: {SmartContract: {is: $token2}}}}, Transaction: {From: {not: $mev}}}
    ) {
      count(distinct: Trade_Sell_Seller)
    }
    Total_Transactions: DEXTrades(
      where: {Block: {Time: {since: "2023-09-27T01:00:00Z", till: $tilltime}}, Trade: {Buy: {Currency: {SmartContract: {is: $token}}}, Sell: {Currency: {SmartContract: {is: $token2}}}}, Transaction: {From: {not: $mev}}}
    ) {
      count(distinct: Transaction_Hash)
    }
    Total_Buy_Amount: DEXTrades(
      where: {Block: {Time: {since: "2023-09-27T01:00:00Z", till: $tilltime}}, Trade: {Buy: {Currency: {SmartContract: {is: $token}}}, Sell: {Currency: {SmartContract: {is: $token2}}}}, Transaction: {From: {not: $mev}}}
    ) {
      sum(of: Trade_Buy_Amount)
    }
    Total_Sell_Amount: DEXTrades(
      where: {Block: {Time: {since: "2023-09-27T01:00:00Z", till: $tilltime}}, Trade: {Buy: {Currency: {SmartContract: {is: $token}}}, Sell: {Currency: {SmartContract: {is: $token2}}}}, Transaction: {From: {not: $mev}}}
    ) {
      sum(of: Trade_Sell_Amount)
    }
  }
}

Variables

{
  "network":"eth","token":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 
  "token2":"0x4d55B39eC653fB96E70f986988A128e39EC70d35", 
  "mev":"0xf9cAFEb32467994e3AFfd61E30865E5Ab32ABE68",
  "tilltime": "2024-01-31T18:58:11Z"
}

Similar queries