solana query

Returns DEX trades by token on Solana, where currency mint address is AtFBqD…pump, side currency mint address is So1111…1112 and block time since 2025-06-12: currency mint address, sum of trade side amount in USD and count.

By gaurav · saved 12 June 2025 · run 46 times · Bitquery API v2

What it returns

Filters

The query

query GetVolumeStats($tokens: [String!], $time_5min_ago: DateTime!, $time_1h_ago: DateTime!, $time_8h_ago: DateTime!) {
  Solana(dataset: combined) {
    stats_1h: DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {in: $tokens}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Block: {Time: {since: $time_1h_ago}}}
    ) {
      Trade {
        Currency {
          MintAddress
        }
      }
      buy_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sell_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      volume_1h: sum(of: Trade_Side_AmountInUSD)
      buys_1h: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sells_1h: count(if: {Trade: {Side: {Type: {is: sell}}}})
      trades_1h: count
    }
    stats_5m: DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {in: $tokens}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Block: {Time: {since: $time_5min_ago}}}
    ) {
      Trade {
        Currency {
          MintAddress
        }
      }
      buy_volume_5m: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sell_volume_5m: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      volume_5m: sum(of: Trade_Side_AmountInUSD)
      buys_5m: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sells_5m: count(if: {Trade: {Side: {Type: {is: sell}}}})
      trades_5m: count
    }
    stats_8h: DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {in: $tokens}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}, Block: {Time: {since: $time_8h_ago}}}
    ) {
      Trade {
        Currency {
          MintAddress
        }
      }
      buy_volume_8h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      sell_volume_8h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      volume_8h: sum(of: Trade_Side_AmountInUSD)
      buys_8h: count(if: {Trade: {Side: {Type: {is: buy}}}})
      sells_8h: count(if: {Trade: {Side: {Type: {is: sell}}}})
      trades_8h: count
    }
  }
}

Variables

{
  "tokens": [
    "AtFBqDkrCxhNS2RJ7Q5uL2LFEGgfvMnj9AvLpvMZpump"
  ],
  "time_5min_ago": "2025-06-12T16:57:00Z",
  "time_1h_ago": "2025-06-12T16:02:00Z",
  "time_8h_ago": "2025-06-12T09:02:00Z"
}

Similar queries