Top-traders-in-eth_stonks

Returns 20 DEX trades by token on Ethereum, where currency smart contract is 0x7D4A…2aF4, sorted by volume, highest first: from, protocol name, protocol family, currency symbol, currency name, smart contract, side currency name and 4 more fields.

By Miroshnichenko Vlad · saved 8 July 2024 · run 28 times · Bitquery API v2

What it returns

Filters

The query

query TopTraders($token: String) {
  EVM(network: eth, dataset: combined) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volume"}
      limit: {count: 20}
      where: {Trade: {Currency: {SmartContract: {is: $token}}}, TransactionStatus: {Success: true}}
    ) {
      Transaction {
        From
      }
      Trade {
        Dex {
          ProtocolName
          ProtocolFamily
        }
        Currency {
          Symbol
          Name
          SmartContract
        }
        Side {
          Currency {
            Name
            Symbol
            SmartContract
          }
        }
      }
      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)
    }
  }
}

Variables

{
  "token": "0x7D4A23832FaD83258B32ce4Fd3109Ceef4332aF4"
}

Similar queries