ScriptingData Types
Open Interest
Normalized open interest records for Market Lab scripts.
Open Interest
type OpenInterest = {
t: number
value: number
o: number
h: number
l: number
c: number
n: number
mark_price?: number
notional?: number
}tis Unix milliseconds.valueis the current normalized OI value and equalscfor candle records.o,h,l, andccontain period OHLC when the provider supplies it.nis the sample count.- BULK snapshots can include
mark_priceandnotional.
export function onData(ctx, input, history) {
const current = history.source('oi@binancef@mmt', 0)
const previous = history.source('oi@binancef@mmt', 1)
if (!current || !previous) return
return {
metrics: {
oi: current.value,
change: current.value - previous.value,
},
}
}