Skip to main content

tracer.data.taker_ratio#

Taker buy/sell ratio from /api/v1/perp/taker-ratio.

SYNTAX#

tracer.data.taker_ratio: SourceHandle  // Taker buy/sell ratio + bounded buy share

ARGUMENTS#

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

RETURNS#

GenericSeriesSourceData — { kind: 'taker-ratio', shape: 'series', values: { time, ratio, buy_share } }

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.buy_share[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: "Taker Buy Share", pane: "sub" }
const tr = tracer.data.taker_ratio;
function onBar(i, ctx) {
  // generic series: match by timestamp, not bar index (see REMARKS)
  const t = candles[i].time;
  const j = tr.values.time.lastIndexOf(t); // exact ts; else scan for nearest ts <= t
  // buy_share is bounded [0,1] — friendlier for thresholding than ratio.
  plot("buy_share", j >= 0 ? tr.values.buy_share[j] : null);
}