Buys, Sells, BuyVolume, SellVolume, Makers, TotalTradedVolume, PriceinUSD, price change for solana token pair

Returns DEX trades by token on Solana, where currency mint address is 27G8Mt…idD4, side currency mint address is EPjFWd…Dt1v and market market address is HD8i7q…cDpj: currency name, currency mint address, currency symbol, price in USD, trade price, protocol name, protocol family and 8 more fields.

By Akshat · saved 6 March 2026 · run 6 times · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String!, $side_token: String!, $pair_address: String!) {
  Solana(dataset: realtime) {
    DEXTradeByTokens(
      where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: $token}}, Side: {Currency: {MintAddress: {is: $side_token}}}, Market: {MarketAddress: {is: $pair_address}}}, Block: {Time: {since_relative: {hours_ago: 6}}}}
    ) {
      Trade {
        Currency {
          Name
          MintAddress
          Symbol
        }
        usd_price_6h: PriceInUSD(minimum: Block_Time)
        usd_price_1h: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after_relative: {hours_ago: 1}}}}
        )
        usd_price_5min: PriceInUSD(
          minimum: Block_Time
          if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
        )
        current_usd_Price: PriceInUSD(maximum: Block_Time)
        price_6h: Price(minimum: Block_Time)
        price_1h: Price(
          minimum: Block_Time
          if: {Block: {Time: {after_relative: {hours_ago: 1}}}}
        )
        price_5min: Price(
          minimum: Block_Time
          if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
        )
        current_Price: Price(maximum: Block_Time)
        Dex {
          ProtocolName
          ProtocolFamily
          ProgramAddress
        }
        Market {
          MarketAddress
        }
        Side {
          Currency {
            Symbol
            Name
            MintAddress
          }
        }
      }
      price_change_5min: calculate(
        expression: "( ( $Trade_current_Price - $Trade_price_5min ) / $Trade_price_5min ) * 100"
      )
      price_change_1h: calculate(
        expression: "( ( $Trade_current_Price - $Trade_price_1h ) / $Trade_price_1h ) * 100"
      )
      price_change_6h: calculate(
        expression: "( ( $Trade_current_Price - $Trade_price_6h ) / $Trade_price_6h ) * 100"
      )
      makers_6h: count(distinct: Transaction_Signer)
      makers_1h: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      makers_5min: count(
        distinct: Transaction_Signer
        if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      buyers_6h: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      buyers_1h: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      buyers_5min: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      sellers_6h: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      sellers_1h: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      sellers_5min: count(
        distinct: Transaction_Signer
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      trades_6h: count
      trades_1h: count(if: {Block: {Time: {after_relative: {hours_ago: 1}}}})
      trades_5min: count(if: {Block: {Time: {after_relative: {minutes_ago: 5}}}})
      traded_volume_6h: sum(of: Trade_Side_AmountInUSD)
      traded_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      traded_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      buy_volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}}
      )
      buy_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      buy_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      sell_volume_6h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}}
      )
      sell_volume_1h: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      sell_volume_5min: sum(
        of: Trade_Side_AmountInUSD
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      buys_6h: count(if: {Trade: {Side: {Type: {is: buy}}}})
      buys_1h: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      buys_5min: count(
        if: {Trade: {Side: {Type: {is: buy}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
      sells_6h: count(if: {Trade: {Side: {Type: {is: sell}}}})
      sells_1h: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {hours_ago: 1}}}}
      )
      sells_5min: count(
        if: {Trade: {Side: {Type: {is: sell}}}, Block: {Time: {after_relative: {minutes_ago: 5}}}}
      )
    }
  }
}

Variables

{
  "token": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4",
  "side_token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "pair_address": "HD8i7qr1hd9ida6sN71RbkLxbWcbvZS4NA5CY6vfcDpj"
}

Similar queries