Skip to main content

Exchange data

Two data sources that Pine Script does not have. Enable them at top level; they are only loaded for scripts that ask for them.

Order flow​

const flow = orderflow();

export function onBar(): void {
plotPane("delta", flow.delta, "flow");
plotPane("cvd", flow.cvd, "cvd");
}
MemberValue
flow.buyVolumeAggressive buy volume in the bar, base units
flow.sellVolumeAggressive sell volume in the bar, base units
flow.deltabuyVolume - sellVolume
flow.cvdCumulative volume delta since the first loaded bar

Read delta and cvd inside onBar().

Funding and open interest​

const deriv = derivatives();

export function onBar(): void {
const fundingPct = nz(deriv.fundingRate[0]) * 100;
}
MemberValue
deriv.fundingRateFunding rate at the last snapshot in the bar
deriv.openInterestOpen interest, base units
deriv.openInterestQuoteOpen interest, quote units

Coverage and na​

These series are na where there is no data:

  • on exchanges without coverage,
  • on spot markets (funding and open interest),
  • before the data feed started for that market,
  • in the browser preview, which does not load this data yet.

Write scripts that still behave on na, for example with nz() in filters so a missing value passes the filter instead of blocking every trade.

On a live chart the newest bar's order flow can be incomplete until the data feed catches up. Use [1] for signals.