volume with intervals sol

Returns DEX trades by token on Solana, where currency mint address is Es9vMF…wNYB, block time since 2024-12-14 and block time till 2024-12-14, sorted by block OHLC interval: block time, sum of trade amount in USD, currency name and count.

By kirill · saved 18 December 2024 · run 63 times · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String, $from_date_time: DateTime, $to_date_time: DateTime, $interval_minutes: Int) {
  Solana(dataset: combined) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_OHLC_interval"}
      where: {Trade: {Currency: {MintAddress: {is: $token}}, PriceAsymmetry: {le: 0.2}}, Block: {Time: {since: $from_date_time, till: $to_date_time}}}
    ) {
      Block {
        OHLC_interval: Time(interval: {in: minutes, count: $interval_minutes})
      }
      TotalVolumeUSD: sum(of: Trade_AmountInUSD)
      # BuyVolumeUSD: sum(
      #   of: Trade_Side_AmountInUSD
      #   if: {Trade: {Side: {Type: {is: sell}}}}
      # )
      # SellVolumeUSD: sum(
      #   of: Trade_Side_AmountInUSD
      #   if: {Trade: {Side: {Type: {is: buy}}}}
      # )
      Trade {
        TokenName: Currency {
          Name
        }
        # HighPrice: PriceInUSD(maximum: Trade_PriceInUSD)
        # LowPrice: PriceInUSD(minimum: Trade_PriceInUSD)
        # OpenPrice: PriceInUSD(minimum: Block_Slot)
        # ClosePrice: PriceInUSD(maximum: Block_Slot)
      }
      TotalTrades: count
      Buys: count(if: {Trade: {Side: {Type: {is: sell}}}})
      Sells: count(if: {Trade: {Side: {Type: {is: buy}}}})
    }
  }
}

Variables

{
  "token": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
  "interval_minutes": 10,
  "from_date_time": "2024-12-14T12:42:35Z", "to_date_time": "2024-12-14T14:42:35Z"
}

Similar queries