Skip to main content

tracer.aggregated.ohlcv#

Cross-venue VWAP-merged OHLCV bars.

SYNTAX#

tracer.aggregated.ohlcv: SourceHandle  // VWAP-merged cross-venue OHLCV

ARGUMENTS#

  • opts.symbol (string) — Trading pair (default: chart symbol).
  • opts.interval (string) — Candle interval (default: chart interval).
  • opts.market ('perp' | 'spot') — Default 'perp'. Set 'spot' to merge across spot venues instead.
  • opts.exchanges (string) — Comma-separated exchange selector or '*' (default: all supported venues for the kind).

RETURNS#

GenericSeriesSourceData — { kind: 'aggregated-ohlcv', shape: 'series', values: { time: number[], o: number[], h: number[], l: number[], c: number[], v: number[] } }

REMARKS#

Generic series — rows arrive at the source's native cadence and are NOT 1:1 with chart candles. To align, match values.time[i] (unix SECONDS) against candles[j].time; do not assume row i corresponds to bar i (values.c[i] is generally NOT bar i's value). (Per-candle kinds like oi/funding are the exception — those are forward-filled to your candles.)

EXAMPLE#

// @indicator { name: "VWAP Cross-Venue", overlay: true }
const agg = tracer.aggregated.ohlcv;
function onBar(i, ctx) {
  // generic series: match by timestamp, not bar index (see REMARKS)
  const t = candles[i].time;
  const j = agg.values.time.lastIndexOf(t); // exact ts; else scan for nearest ts <= t
  plot("vwap", j >= 0 ? agg.values.c[j] : null);
}
// Alt with options:
// const spotAgg = source("aggregated-ohlcv", { market: "spot", symbol: "BTCUSDT" });