getTradingActivity

Returns DEX trades by token on Ethereum, where currency smart contract is 0xdac1…1ec7, block time since 2025-02-21 and block time till 2025-02-22: count, sum of trade side amount in USD and trade price.

By Jose · saved 22 February 2025 · run 48 times · Bitquery API v2

What it returns

Filters

The query

query getTradingActivity(
  $dataset: dataset_arg_enum!
  $network: evm_network!
  $tokenAddress: String
  $since: DateTime!
  $till: DateTime!
  $min5After: DateTime!
  $hour1After: DateTime!
  $hour6After: DateTime!
) {
  EVM(dataset: $dataset, network: $network) {
    DEXTradeByTokens(
      where: {
        Block: {
          Time: { since: $since, till: $till }
        }
        TransactionStatus: { Success: true }
        Trade: { Currency: { SmartContract: { is: $tokenAddress } } }
      }
    ) {
      makersAt5Min: count(
        distinct: Transaction_From
        if: { Block: { Time: { till: $min5After } } }
      )
      makersAt1Hour: count(
        distinct: Transaction_From
        if: { Block: { Time: { till: $hour1After } } }
      )
      makersAt6Hour: count(
        distinct: Transaction_From
        if: { Block: { Time: { till: $hour6After } } }
      )
      makersAt24Hour: count(
        distinct: Transaction_From
      )
      uniqueBuyersAt5Min: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $min5After } }
        }
      )
      uniqueBuyersAtHour1: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      uniqueBuyersAtHour6: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      uniqueBuyersAtHour24: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: sell } } }
        }
      )
      uniqueSellersAt5Min: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $min5After } }
        }
      )
      uniqueSellersAt1Hour: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      uniqueSellersAt6Hour: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      uniqueSellersAt24Hour: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: buy } } }
        }
      )
      volumeBuyAt5Min: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $min5After } }
        }
      )
      volumeBuyAt1Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      volumeBuyAt6Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      volumeBuyAt24Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: sell } } }
        }
      )
      volumeSellAt5Min: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $min5After } }
        }
      )
      volumeSellAt1Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      volumeSellAt6Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      volumeSellAt24Hour: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: buy } } }
        }
      )
      buysAt5Min: count(
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $min5After } }
        }
      )
      buysAt1Hour: count(
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      buysAt6Hour: count(
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      buysAt24Hour: count(
        if: {
          Trade: { Side: { Type: { is: sell } } }
        }
      )
      sellsAt5Min: count(
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $min5After } }
        }
      )
      sellsAt1Hour: count(
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour1After } }
        }
      )
      sellsAt6Hour: count(
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { till: $hour6After } }
        }
      )
      sellsAt24Hour: count(
        if: {
          Trade: { Side: { Type: { is: buy } } }
        }
      )
      Trade {
        priceAt5Min: Price(
          minimum: Block_Time
          if: { Block: { Time: { after: $min5After } } }
        )
        priceAt1Hour: Price(
          minimum: Block_Time
          if: { Block: { Time: { after: $hour1After } } }
        )
        priceAt6Hour: Price(
          minimum: Block_Time
          if: { Block: { Time: { after: $hour6After } } }
        )
        priceAt24Hour: Price(maximum: Block_Time)
      }
    }
  }
}

Variables

{
  "network": "eth",
  "dataset": "realtime",
  "tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "since": "2025-02-21T12:18:59.000Z",
  "till": "2025-02-22T12:18:59.000Z",
  "min5After": "2025-02-21T12:23:59.000Z",
  "hour1After": "2025-02-21T13:18:59.000Z",
  "hour6After": "2025-02-21T18:18:59.000Z"
}

Similar queries