Copy of top-example-with-count

Returns 3000 DEX trades by token on Ethereum, where currency smart contract is 0x8802…1ab6, sorted by volume, highest first: from, to, sum of trade side amount in USD, sum of trade amount, count and sum of log index.

By Vlad · saved 4 October 2024 · Bitquery API v2

What it returns

Filters

The query

query TopTraders {
  EVM(network: eth, dataset: archive) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volume"}
      limit: {count: 3000}
      where: {Trade: {Currency: {SmartContract: {is: "0x8802269D1283cdB2a5a329649E5cB4CdcEE91ab6"}}}, TransactionStatus: {Success: true}}
    ) {
      Transaction {
        From
        To
      }
      bought: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
        selectWhere: {gt: "0"}
      )
      sold: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
        selectWhere: {gt: "0"}
      )
      volume: sum(of: Trade_Amount)
      volumeUsd: sum(of: Trade_Side_AmountInUSD)
      count(distinct: Trade_PriceInUSD)
      sellcount: sum(
        of: Log_Index
        if: {Trade: {Side: {Type: {is: buy}}}}
        selectWhere: {gt: "0"}
      )
     buycount: sum(
        of: Log_Index
        if: {Trade: {Side: {Type: {is: sell}}}}
        selectWhere: {gt: "0"}
      )
    }
  }
}

Similar queries