Solana Token Details Combined Query

Returns one DEX trade by token on Solana, where currency mint address is GcKAEB…pump, market market address is FY1XGf…DcLJ and side currency mint address is So1111…1112, sorted by block slot, highest first: block time, price in USD, URI, currency name, currency mint address, currency symbol, protocol name and 8 more fields.

By Jastyne · saved 6 January 2025 · run 10 times · Bitquery API v2

What it returns

Filters

The query

query CombinedQuery(
  $address: String!, 
  $pair_address: String!,
  $time_24h_ago: DateTime!, 
  $time_1h_ago: DateTime!, 
  $time_6h_ago: DateTime!,
  $time_5min_ago: DateTime!
) {
  ath_and_uri: Solana(network: solana, dataset: combined) {
    DEXTradeByTokens(
      where: { Trade: { Currency: { MintAddress: { is: $address } }, Market: { MarketAddress: { is: $pair_address } } } }
      orderBy: { descendingByField: "Trade_ATH_USD_maximum" }
      limit: { count: 1 }
    ) {
      Block { Time }
      Trade {
        ATH_USD: PriceInUSD(maximum: Trade_Price)
        Currency { Uri }
      }
    }
  }

  currentUsdPrice: Solana {
    DEXTradeByTokens(
      where: {Trade: {Currency: {MintAddress: {is: $address}}}, Transaction: {Result: {Success: true}}}
      limit: {count: 1}
      orderBy: {descending: Block_Slot}
    ) {
      Trade {
        PriceInUSD
      }
    }
  }


  hour_24_data: Solana(dataset: combined) {
    DEXTradeByTokens(
      where: { 
        Transaction: { Result: { Success: true } },
        Trade: { Currency: { MintAddress: { is: $address } }, Side: { Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } } }, Market: { MarketAddress: { is: $pair_address } } },
        Block: { Time: { since: $time_24h_ago } }
      }
    ) {
      Trade {
        Currency { Name MintAddress Symbol }
        usd_24h: PriceInUSD(minimum: Block_Time if: { Block: { Time: { after: $time_24h_ago } } })
        Dex { ProtocolName ProtocolFamily ProgramAddress }
        Market { MarketAddress }
        Side { Currency { Symbol Name MintAddress } }
      }
      trades_total: count
      trades_24h: count(if: { Block: { Time: { after: $time_24h_ago } } })
      traded_volume_total: sum(of: Trade_Side_AmountInUSD)
      traded_volume_24h: sum(of: Trade_Side_AmountInUSD if: { Block: { Time: { after: $time_24h_ago } } })
      buy_volume_total: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: buy } } } })
      buy_volume_24h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_24h_ago } } })
      sell_volume_total: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: sell } } } })
      sell_volume_24h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_24h_ago } } })
      buys_total: count(if: { Trade: { Side: { Type: { is: buy } } } })
      buys_24h: count(if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_24h_ago } } })
      sells_total: count(if: { Trade: { Side: { Type: { is: sell } } } })
      sells_24h: count(if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_24h_ago } } })
    }
  }

  up_to_6h_data: Solana(dataset: realtime) {
    DEXTradeByTokens(
      where: { 
        Transaction: { Result: { Success: true } },
        Trade: { Currency: { MintAddress: { is: $address } }, Side: { Currency: { MintAddress: { is: "So11111111111111111111111111111111111111112" } } }, Market: { MarketAddress: { is: $pair_address } } },
        Block: { Time: { since: $time_6h_ago } }
      }
    ) {
      Trade {
        Currency { Name MintAddress Symbol }
        usd_6h: PriceInUSD(minimum: Block_Time if: { Block: { Time: { after: $time_6h_ago } } })
        usd_1h: PriceInUSD(minimum: Block_Time if: { Block: { Time: { after: $time_1h_ago } } })
        usd_5min: PriceInUSD(minimum: Block_Time if: { Block: { Time: { after: $time_5min_ago } } })
        currentUSD: PriceInUSD(maximum: Block_Time)
        Dex { ProtocolName ProtocolFamily ProgramAddress }
        Market { MarketAddress }
        Side { Currency { Symbol Name MintAddress } }
      }
        makers_6h: count(distinct: Transaction_Signer if: { Block: { Time: { after: $time_6h_ago } } })
        makers_1h: count(distinct: Transaction_Signer if: { Block: { Time: { after: $time_1h_ago } } })
        makers_5min: count(distinct: Transaction_Signer if: { Block: { Time: { after: $time_5min_ago } } })
        trades_6h: count(if: { Block: { Time: { after: $time_6h_ago } } })
        trades_1h: count(if: { Block: { Time: { after: $time_1h_ago } } })
        trades_5min: count(if: { Block: { Time: { after: $time_5min_ago } } })
        traded_volume_6h: sum(of: Trade_Side_AmountInUSD if: { Block: { Time: { after: $time_6h_ago } } })
        traded_volume_1h: sum(of: Trade_Side_AmountInUSD if: { Block: { Time: { after: $time_1h_ago } } })
        traded_volume_5min: sum(of: Trade_Side_AmountInUSD if: { Block: { Time: { after: $time_5min_ago } } })
        buy_volume_6h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_6h_ago } } })
        buy_volume_1h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_1h_ago } } })
        buy_volume_5min: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_5min_ago } } })
        sell_volume_6h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_6h_ago } } })
        sell_volume_1h: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_1h_ago } } })
        sell_volume_5min: sum(of: Trade_Side_AmountInUSD if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_5min_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_5min: count(if: { Trade: { Side: { Type: { is: buy } } }, Block: { Time: { after: $time_5min_ago } } })
        sells_6h: count(if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_6h_ago } } })
        sells_1h: count(if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_1h_ago } } })
        sells_5min: count(if: { Trade: { Side: { Type: { is: sell } } }, Block: { Time: { after: $time_5min_ago } } })
    }
  }
  }

Variables

{
  "address": "GcKAEB28akwesqYuDuDtha1xpxRP41eVMGuhSiKEpump",
  "pair_address": "FY1XGfQ4189Lr1nP4M9CMtnVdAHegiJVKAjEXjS4DcLJ",
  "time_24h_ago": "2025-01-05T15:25:43+07:00",
  "time_1h_ago": "2025-01-06T14:25:43+07:00",
  "time_6h_ago": "2025-01-06T09:25:43+07:00",
  "time_5min_ago": "2025-01-06T15:20:43+07:00"
}

Similar queries