buy-sell-volume-for-an-interval

Returns DEX trades by token, where currency smart contract is 0xc02a…6cc2, block time since 2024-10-15 and block time till 2024-10-15: sum of trade amount in USD and sum of trade side amount in USD.

By Kshitij Mahajan · saved 15 October 2024 · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String = "", $since: DateTime, $till: DateTime) {
  EVM {
    DEXTradeByTokens(
      where: {Trade: {Currency: {SmartContract: {is: $token}}, PriceInUSD: {ne: 0}}, Block: {Time: {since: $since, till: $till}}}
    ) {
      volumeBuy: sum(of: Trade_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
      volumeSell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
      
    }
  }
}

Variables

{
  "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "since": "2024-10-15T08:30:00Z",
  "till": "2024-10-15T08:35:00Z"
}

Similar queries