hhh

Returns 100 DEX pools and DEX trades by token on Solana, sorted by volume 24 h, highest first: base currency name, base currency mint address, base currency symbol, base post amount in USD, protocol name, protocol family, sum of pool base post amount in USD and 11 more fields.

By florid · saved 9 March 2025 · run 3 times · Bitquery API v2

What it returns

The query

query ($time_24h_ago: DateTime!, $time_6h_ago: DateTime!, $time_1h_ago: DateTime!, $time_5m_ago: DateTime!, $order_by_field: String!, $limit: Int!) {
  Solana {
    DEXPools(
      limit: {count: $limit}
      orderBy: {descending: Pool_Base_PostAmountInUSD}
      limitBy: {by: Pool_Market_BaseCurrency_MintAddress, count: 1}
    ) {
      Pool {
        Market {
          BaseCurrency {
            Name
            MintAddress
            Symbol
          }
        }
        Base {
          liqudity: PostAmountInUSD(maximum: Block_Time)
        }
        Dex {
          ProtocolName
          ProtocolFamily
        }
      }
      total_liquidity: sum(of: Pool_Base_PostAmountInUSD)
      Block {
        Time
      }
    }
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}}
      orderBy: {descendingByField: $order_by_field}
      limit: {count: $limit}
    ) {
      Trade {
        Currency {
          Decimals
          Symbol
          Name
          MintAddress
        }
        Amount(maximum: Block_Slot)
        AmountInUSD(maximum: Block_Slot)
        last_price: PriceInUSD(maximum: Block_Time)
        price_24h_ago: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_24h_ago}}}
        )
        price_6h_ago: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_6h_ago}}}
        )
        price_1h_ago: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_1h_ago}}}
        )
        price_5m_ago: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after: $time_5m_ago}}}
        )
      }
      trades_24h: count(if: {Block: {Time: {after: $time_24h_ago}}})
      trades_6h: count(if: {Block: {Time: {after: $time_6h_ago}}})
      trades_1h: count(if: {Block: {Time: {after: $time_1h_ago}}})
      trades_5m: count(if: {Block: {Time: {after: $time_5m_ago}}})
      buys_24h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_24h_ago}}}
      )
      buys_6h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_6h_ago}}}
      )
      buys_1h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_1h_ago}}}
      )
      buys_5m: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after: $time_5m_ago}}}
      )
      volume_24h: sum(
        of: Trade_AmountInUSD
        if: {Block: {Time: {after: $time_24h_ago}}}
      )
      volume_6h: sum(
        of: Trade_AmountInUSD
        if: {Block: {Time: {after: $time_6h_ago}}}
      )
      volume_1h: sum(
        of: Trade_AmountInUSD
        if: {Block: {Time: {after: $time_1h_ago}}}
      )
      volume_5m: sum(
        of: Trade_AmountInUSD
        if: {Block: {Time: {after: $time_5m_ago}}}
      )
      traders_24h: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after: $time_24h_ago}}}
      )
      traders_6h: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after: $time_6h_ago}}}
      )
      traders_1h: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after: $time_1h_ago}}}
      )
      traders_5m: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after: $time_5m_ago}}}
      )
      dexes: uniq(of: Trade_Dex_ProgramAddress)
    }
  }
}

Variables

{
  "time_24h_ago": "2025-03-06T00:00:00Z",
  "time_6h_ago": "2025-03-06T18:00:00Z",
  "time_1h_ago": "2025-03-06T23:00:00Z",
  "time_5m_ago": "2025-03-06T23:55:00Z",
  "order_by_field": "volume_24h",
  "limit": 100
}

Similar queries