ALMOST TOP

Returns 10 DEX trades by token on Ethereum, where side currency smart contract is 0xC02a…6Cc2, sorted by total trades, highest first: price in USD, currency name, currency symbol, side currency name, side currency symbol, protocol name, protocol family and 4 more fields.

By Bohdan · saved 7 December 2024 · Bitquery API v2

What it returns

Filters

The query

query MyQuery($oneHourAgo: DateTime, $min5backtimestamp: DateTime) {
        EVM(network: eth, dataset: realtime) {
          DEXTradeByTokens(
            orderBy: {descendingByField: "total_trades"}
            limit: {count: 10}
            where: {
              Block: {Time: {since: $oneHourAgo}},
              Trade: {Side: {Currency: {SmartContract: {is: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}}}},
              TransactionStatus: {Success: true}
            }
          ) {
            Trade {
              hour1: PriceInUSD(minimum: Block_Time)
              min5: PriceInUSD(minimum: Block_Time, if: { Block: { Time: { after: $min5backtimestamp } } })
              end: PriceInUSD(maximum: Block_Time)
              Currency {
                Name
                Symbol
              }
              Side {
                Currency {
                  Name
                  Symbol
                }
              }
              Dex {
                ProtocolName
                ProtocolFamily
                ProtocolVersion
                SmartContract
              }
            }
            total_trades: count
            totalbuys: count(if: {Trade: {Side: {Type: {is: sell}}}})
            totalsells: count(if: {Trade: {Side: {Type: {is: buy}}}})
            total_traded_volume: sum(of: Trade_Side_AmountInUSD)
          }
        }
      }

Similar queries