ohlc for a pair on Arbitrum

Historical data This query uses the realtime dataset (the default), which holds only a recent window - hours to days depending on the cube. For older data add a dataset to the top-level element: EVM(network: $network, dataset: $dataset, dataset: combined) archive full history combined archive + r

By Akshat · saved 4 December 2024 · run 5 times · Bitquery API v2

What it returns

Filters

The query

# Historical data
#   This query uses the realtime dataset (the default), which holds only a
#   recent window - hours to days depending on the cube.
#
#   For older data add a dataset to the top-level element:
#
#     EVM(network: $network, dataset: $dataset, dataset: combined)
#
#     archive   full history
#     combined  archive + realtime in one result
#
#   Archive and combined need the historical data add-on:
#   https://bitquery.io/pricing
#
# Datasets:  https://docs.bitquery.io/docs/graphql/dataset/archive/
# Retention: https://docs.bitquery.io/docs/graphql/data-coverage-retention/
#

query tradingViewPairs($network: evm_network, $dataset: dataset_arg_enum, $interval: Int, $token: String, $base: String, $time_ago: DateTime) {
  EVM(network: $network, dataset: $dataset) {
    DEXTradeByTokens(
      orderBy: {ascendingByField: "Block_Time"}
      where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $token}}}, Currency: {SmartContract: {is: $base}}, PriceAsymmetry: {le: 0.1}}, Block: {Time: {since: $time_ago}}}
    ) {
      Block {
        Time(interval: {count: $interval, in: minutes})
      }
      Trade {
        open: PriceInUSD(minimum: Block_Time)
        close: PriceInUSD(maximum: Block_Time)
        max: PriceInUSD(maximum: Trade_PriceInUSD)
        min: PriceInUSD(minimum: Trade_PriceInUSD)
      }
      volume: sum(of: Trade_AmountInUSD)
    }
  }
}

Variables

{
  "network": "arbitrum",
  "base": "0x912ce59144191c1204e64559fe8253a0e49e6548",
  "token": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
  "time_ago": "2024-11-17T07:59:49Z",
  "interval": 5,
  "dataset": "realtime"
}

Similar queries