Custom Query

Returns 15 DEX trades by token on Solana, sorted by total trades, highest first: currency name, currency mint address, currency symbol, URI, price in USD, protocol name, protocol family and 3 more fields.

By Mahmoud Yousif · saved 5 February 2025 · Bitquery API v2

What it returns

The query

query MyQuery($start: DateTime, $end: DateTime) {
  Solana {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Block: {Time: {after: $start, before: $end}}, any: [{Trade: {Side: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}}}, {Trade: {Currency: {MintAddress: {not: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, Side: {Currency: {MintAddress: {is: "So11111111111111111111111111111111111111112"}}}}}, {Trade: {Currency: {MintAddress: {notIn: ["So11111111111111111111111111111111111111112", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]}}, Side: {Currency: {MintAddress: {notIn: ["So11111111111111111111111111111111111111112", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]}}}}}], Trade: {Currency: {Uri: {not: ""}, MintAddress: {endsWith: "pump"}}}}
      orderBy: {descendingByField: "total_trades"}
      limit: {count: 15}
    ) {
      Trade {
        Currency {
          Name
          MintAddress
          Symbol
          Uri
        }
        start: PriceInUSD(minimum: Block_Time)
        end: PriceInUSD(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          ProgramAddress
        }
      }
      makers: count(distinct: Transaction_Signer)
      total_trades: count
      total_traded_volume: sum(of: Trade_Side_AmountInUSD)
      total_buy_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      total_sell_volume: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      total_buys: count(if: {Trade: {Side: {Type: {is: buy}}}})
      total_sells: count(if: {Trade: {Side: {Type: {is: sell}}}})
    }
  }
}

Variables

{
  "$start": "2025-02-04T20:33:34.700Z",
  "$end": "2025-02-05T20:33:34.700Z",
  "$count": 10
}

Similar queries