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");
}
| Member | Value |
|---|---|
flow.buyVolume | Aggressive buy volume in the bar, base units |
flow.sellVolume | Aggressive sell volume in the bar, base units |
flow.delta | buyVolume - sellVolume |
flow.cvd | Cumulative 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;
}
| Member | Value |
|---|---|
deriv.fundingRate | Funding rate at the last snapshot in the bar |
deriv.openInterest | Open interest, base units |
deriv.openInterestQuote | Open 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.