Alpha_TEST corrected

Returns 1000 DEX trades by token on Solana, where currency mint address is So1111…1112, sorted by side bought USD, highest first: decimals, sum of trade amount, sum of trade side amount and sum of trade side amount in USD.

By gaurav · saved 15 November 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query TopTraders($token: String, $time_ago: DateTime) {
  Solana(dataset: archive) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "sideBoughtUsd"}
      limit: {count: 1000}
      where: {Trade: {Currency: {MintAddress: {is: $token}}}, Transaction: {Result: {Success: true}}, Block: {Time: {after: $time_ago}}}
    ) {
      Trade {
        Currency {
          Decimals
        }
      }
      bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      sideBought: sum(of: Trade_Side_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
      sideBoughtUsd: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sideSold: sum(of: Trade_Side_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
      sideSoldUsd: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
    }
  }
}

Variables

{
  "base": "41xx693uzU3FH7vmq2erpqc4kZWjwhSntJwAhZGRpump",
  "token": "So11111111111111111111111111111111111111112"
}

Similar queries