pair dex list

Returns DEX trades by token on Ethereum, where currency smart contract is 0xc02a…6cc2, side currency smart contract is 0x0cca…1098 and block time after 2024-09-22, sorted by amount, highest first: protocol family, protocol name, price in USD, sum of trade side amount, unique of trade side currency smart contract and count.

By Akshat · saved 22 September 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query pairDexList($network: evm_network, $token: String, $base: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "amount"}
      where: {Trade: {Currency: {SmartContract: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}}, Block: {Time: {after: $time_3h_ago}}}
    ) {
      Trade {
        Dex {
          ProtocolFamily
          ProtocolName
        }
        price_last: PriceInUSD(maximum: Block_Number)
        price_10min_ago: PriceInUSD(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_10min_ago}}}
        )
        price_1h_ago: PriceInUSD(
          maximum: Block_Number
          if: {Block: {Time: {before: $time_1h_ago}}}
        )
        price_3h_ago: PriceInUSD(minimum: Block_Number)
      }
      amount: sum(of: Trade_Side_Amount)
      pairs: uniq(of: Trade_Side_Currency_SmartContract)
      trades: count
    }
  }
}

Variables

{
  "network": "eth",
  "token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "base": "0x0ccae1bc46fb018dd396ed4c45565d4cb9d41098",
  "time_10min_ago": "2024-09-22T13:10:42Z",
  "time_1h_ago": "2024-09-22T12:20:42Z",
  "time_3h_ago": "2024-09-22T10:20:42Z"
}

Similar queries