Skip to main content
Subscriptions (WebSockets) require a Growth or Enterprise plan. Learn more.

Returns

OnBarsUpdatedResponse

Arguments

pairId
String
The ID of the pair (address:networkId).
quoteToken
The token of interest within the pair. Can be token0 or token1.
subscription {
  onBarsUpdated(
    pairId: "BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y:1399811149"
    quoteToken: token0
  ) {
    pairAddress
    pairId
    networkId
    timestamp
    quoteToken
    quoteTokenAddress
    eventSortKey
    statsType
    aggregates {
      r1 {
        usd {
          t
          o
          h
          l
          c
          v
          volume
          buyers
          sellers
          buys
          sells
          buyVolume
          sellVolume
          liquidity
          transactions
        }
      }
      r5 {
        usd {
          t
          o
          h
          l
          c
          v
        }
      }
      r60 {
        usd {
          t
          o
          h
          l
          c
          v
        }
      }
    }
  }
}
Example Response
{
  "data": {
    "onBarsUpdated": {
      "pairAddress": "BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y",
      "pairId": "BGm1tav58oGcsQJehL9WXBFXF7D27vZsKefj4xJKD5Y:1399811149",
      "networkId": 1399811149,
      "timestamp": 1769559142,
      "quoteToken": "token0",
      "quoteTokenAddress": "So11111111111111111111111111111111111111112",
      "eventSortKey": "0000000396370575#00001095#00000000#00000012",
      "statsType": "UNFILTERED",
      "aggregates": {
        "r1": {
          "usd": {
            "t": 1769559120,
            "o": 126.91645786,
            "h": 126.91645786,
            "l": 126.906300653,
            "c": 126.906300653,
            "v": 16608,
            "volume": "16607.75618360923",
            "buyers": 5,
            "sellers": 0,
            "buys": 7,
            "sells": 0,
            "buyVolume": "16607",
            "sellVolume": "0",
            "liquidity": "1495261.94023",
            "transactions": 7
          }
        },
        "r5": {
          "usd": {
            "t": 1769559000,
            "o": 126.909482001,
            "h": 126.91645786,
            "l": 126.904001603,
            "c": 126.906300653,
            "v": 16727
          }
        },
        "r60": {
          "usd": {
            "t": 1769558400,
            "o": 127.033618681,
            "h": 127.035495596,
            "l": 126.78034421,
            "c": 126.906300653,
            "v": 52148
          }
        }
      }
    }
  }
}

Usage Guidelines

  • Subscribe using pairId in the format pairAddress:networkId
  • Set quoteToken to token0 or token1 to specify which token in the pair is being priced
  • aggregates contains OHLCV bar data across multiple resolutions simultaneously (e.g., r1 for 1-minute, r5 for 5-minute, r60 for 1-hour, r1D for 1-day)
  • Each resolution provides both usd (USD-denominated) and token (native token-denominated) bars
  • Use o, h, l, c for open/high/low/close prices, and v for volume
  • Granular trade metrics like buyers, sellers, buyVolume, and sellVolume are available per bar for trade flow analysis
  • Updates are streamed in real-time with every on-chain swap event

Troubleshooting Tips

Resolutions range from 1-second (r1S) up to 1-week (r1W): r1S, r5S, r15S, r30S, r1 (1 min), r5, r15, r30, r60, r240 (4h), r720 (12h), r1D, r1W. You only need to request the resolutions you need in your query.
usd bars are denominated in US dollars, while token bars are denominated in the paired token (e.g., USDC). Use usd for standard price charts and token for relative price analysis against the quote token.
quoteToken selects which token in the pair is being priced. For example, in a SOL/USDC pair where SOL is token0, setting quoteToken: token0 returns the price of SOL in terms of USDC, while token1 returns the price of USDC in terms of SOL. Check the pair metadata to confirm which token is token0 vs token1.
Filtered excludes suspected bot and sandwich attack transactions for cleaner price data. Unfiltered includes all transactions. Most charting use cases should use Filtered for more accurate price representation.
Updates are sent in real-time with every swap event on the pair. High-volume pairs (e.g., SOL/USDC on Solana) may produce many updates per second, while low-volume pairs update less frequently.