ohclv_liquidty_aggregated

Returns DEX trades by token and balance updates on Solana, where currency mint address is GXEN3Y…UJ5e, account owner is J8iRyr…oj62 and block time since 2025-06-20, sorted by block timefield: block time, sum of trade amount, sum of trade side amount, sum of trade side amount in USD, trade price, count, post balance and 2 more fields.

By Arslan A · saved 25 June 2025 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query TokenOHLCVWithLiquidity(
  $mintAddress: String!, 
  $pairAddress: String!, 
  $startTime: DateTime!, 
  $endTime: DateTime!
) {
  Solana(network: solana) {
    # OHLCV data
    ohlcv: DEXTradeByTokens(
      orderBy: { ascendingByField: "Block_Timefield" }
      where: {
        Trade: {
          Currency: { MintAddress: { is: $mintAddress } },
          PriceAsymmetry: { lt: 0.1 }
        },
        Transaction: { Result: { Success: true } },
        Block: { Time: { since: $startTime, till: $endTime } }
      }
    ) {
      Block {
        Timefield: Time(interval: { in: minutes, count: 1 })
      }
      token_volume: sum(of: Trade_Amount)
      sol_volume: sum(of: Trade_Side_Amount)
      usd_volume: sum(of: Trade_Side_AmountInUSD)
      Trade {
        high: Price(maximum: Trade_Price)
        low: Price(minimum: Trade_Price)
        open: Price(minimum: Block_Slot)
        close: Price(maximum: Block_Slot)
      }
      count
    }
    
    # Liquidity data aggregated by 1-minute intervals
    liquidity: BalanceUpdates(
      orderBy: { ascendingByField: "Block_Timefield" }
      where: {
        BalanceUpdate: {
          Account: { Owner: { is: $pairAddress } }
        },
        Block: { Time: { since: $startTime, till: $endTime } }
      }
    ) {
      Block {
        Timefield: Time(interval: { in: minutes, count: 1 })
      }
      BalanceUpdate {
        # Latest balance in the interval (using maximum Block_Time)
        latest_balance: PostBalance(maximum: Block_Time)
        # Earliest balance in the interval (using minimum Block_Time)
        earliest_balance: PostBalance(minimum: Block_Time)
        Currency {
          Symbol
          MintAddress
        }
      }
      # Count of balance updates in this interval
      balance_updates_count: count
    }
  }
}

Variables

{
  "mintAddress": "GXEN3YQNUvKvv5pKNKZ1LCrUk2mKRZLYrfwxxckaUJ5e",
  "pairAddress": "J8iRyr4SXmBbtdY9aTY1oFLkRLrCibHxqdyTYA4Woj62",
  "startTime": "2025-06-20T00:00:00Z",
  "endTime": "2025-06-22T00:00:00Z"
}

Similar queries