alpha4

Returns 1000 DEX trades by token on Solana, where currency mint address is 6URpLQ…aen2 and block time after 2024-01-01, sorted by side bought USD, highest first: account owner, decimals, sum of trade amount, sum of trade side amount, sum of trade side amount in USD and count.

By Alpha Spotter · saved 18 November 2024 · run 3 times · Bitquery API v2

What it returns

Filters

The query

query TopTraders($token: String, $time_ago: DateTime) {
  Solana(dataset: combined) {
    DEXTradeByTokens(
      orderBy: {descendingByField: "sideBoughtUsd"}
      limit: {count: 1000}
      where: {
        Trade: {
          Currency: {MintAddress: {is: $token}}
        }, 
        Transaction: {Result: {Success: true}}, 
        Block: {Time: {after: $time_ago}}
      }
    ) {
      AccountOwner: Trade {
        Account {
          Owner
        }
      }
      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}}}}
      )
      buyCount: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sellCount: count(if: {Trade: {Side: {Type: {is: sell}}}})
    }
  }
}

Variables

{
  "token": "6URpLQmJStfS8hCk2uiDstCJJYqNnGyUcYFLT786aen2",
  "time_ago": "2024-01-01T10:59:24Z"
}

Similar queries