top traders of a token on matic

Returns 100 DEX trades by token on Polygon, where currency smart contract is 0x4dba…94e0 and block time since 2024-11-10, sorted by volume USD, highest first: buyer, seller, protocol family, sum of trade amount and sum of trade side amount in USD.

By Divyasshree · saved 13 November 2024 · Bitquery API v2

What it returns

Filters

The query

query topTraders($network: evm_network, $time_ago: DateTime, $token: String) {
  EVM(network: $network) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "volumeUsd"}
      limit: {count: 100}
      where: {Trade: {Currency: {SmartContract: {is: $token}}}, Block: {Time: {since: $time_ago}}}
    ) {
      Trade {
        Buyer
        Seller
        Dex {
          ProtocolFamily
        }
      }
      bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      volume: sum(of: Trade_Amount)
      volumeUsd: sum(of: Trade_Side_AmountInUSD)
    }
  }
}

Variables

{
  "network": "matic",
  "token": "0x4dba7eb38ab96987b2b9c267f9d399da367194e0",
  "time_ago": "2024-11-10T05:00:02Z"
}

Similar queries