Skip to main content

tracer.data.cvd#

Cumulative volume delta from /api/v1/perp/cvd.

SYNTAX#

tracer.data.cvd: SourceHandle  // Cumulative volume delta

ARGUMENTS#

  • opts.symbol (string) — Trading pair.
  • opts.exchange (string) — Exchange.
  • opts.interval (string) — Bucket interval.

RETURNS#

GenericSeriesSourceData — { kind: 'cvd', shape: 'series', values: { time, cvd } }

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.cvd[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: "CVD", pane: "sub" }
const c = tracer.data.cvd;
function onBar(i, ctx) {
  // generic series: match by timestamp, not bar index (see REMARKS)
  const t = candles[i].time;
  const j = c.values.time.lastIndexOf(t); // exact ts; else scan for nearest ts <= t
  plot("cvd", j >= 0 ? c.values.cvd[j] : null);
}