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

Returns DEX trades by token on Ethereum, where currency smart contract is 0x6982…1933 and DEX smart contract is 0xA43f…Ec9f: currency name, smart contract, currency symbol, price in USD, protocol name, protocol family, side currency symbol and 4 more fields.

By Divyasshree · saved 6 June 2025 · Bitquery API v2

What it returns

Filters

The query

query MyQuery(
  $network: evm_network
  $token: String
  $pairAddress: String
  $t_24h_ago: DateTime
) {
  EVM(dataset: combined, network: $network) {
    DEXTradeByTokens(
      where: {
        TransactionStatus: { Success: true }
        Trade: {
          Currency: { SmartContract: { is: $token } }
          Dex: { SmartContract: { is: $pairAddress } }
        }
      }
    ) {
      Trade {
        Currency {
          Name
          SmartContract
          Symbol
        }
        Price_at_24h_ago: PriceInUSD(
          minimum: Block_Time
          if: { Block: { Time: { after: $t_24h_ago } } }
        )
        Dex {
          ProtocolName
          ProtocolFamily
          SmartContract
        }
        Side {
          Currency {
            Symbol
            Name
            SmartContract
          }
        }
      }

      makers_24h_ago: count(
        distinct: Transaction_From
        if: { Block: { Time: { after: $t_24h_ago } } }
      )

      buyers_24h_ago: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )

      sellers_24h_ago: count(
        distinct: Transaction_From
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )

      trades_24h_ago: count(
        if: { Block: { Time: { after: $t_24h_ago } } }
      )

      traded_volume_24h_ago: sum(
        of: Trade_Side_AmountInUSD
        if: { Block: { Time: { after: $t_24h_ago } } }
      )

      buy_volume_24h_ago: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )

      sell_volume_24h_ago: sum(
        of: Trade_Side_AmountInUSD
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )

      buys_24h_ago: count(
        if: {
          Trade: { Side: { Type: { is: sell } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )

      sells_24h_ago: count(
        if: {
          Trade: { Side: { Type: { is: buy } } }
          Block: { Time: { after: $t_24h_ago } }
        }
      )
    }
  }
}

Variables

{
  "network": "eth",
  "token": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
  "pairAddress": "0xA43fe16908251ee70EF74718545e4FE6C5cCEc9f",
  "t_24h_ago": "2025-06-05T12:20:00Z"
}

Similar queries