Skip to main content
The data a script reads. Declared at the top level only. Inside a handler of stream S, S’s fields describe the bar or event being run. Every other stream reads “as of” that moment: its last confirmed value at or before the current bar’s time. That is the no-lookahead rule, for every kind of data.

bars()

The chart’s bars by default, or another market or interval.

MarketInfo

string
Venue
number
The smallest price step at the current price. Hyperliquid’s step changes with price.
number

IntervalInfo

IntervalCode
number
Length in milliseconds for time bars (for months, the average month); na for bars that close on trades.
boolean

BarView

One bar. Values the source does not provide are na.
Time
Time
When the bar ends (exclusive). For time bars, time + interval.ms; for months, the next month’s open.
number
number
number
number
number
Base volume.
number
Quote (USD) volume.
number
number
Taker buy and sell base volume, when the host has them.
number
(name: SourceName): number
A bar value by name, such as source('hl2').

BarsOptions

string
A market other than the chart’s, such as ETH.
Venue
IntervalCode
An interval other than the chart’s, such as 4h.

Bars

MarketInfo
IntervalInfo
number
Bar number on this stream, from 0 at the first loaded bar.
boolean
True when this run is for a closed bar; false for an update of the forming bar.
boolean
True on the first run of a bar.
boolean
True on the newest bar the chart has.
number
The index of this stream’s newest bar, known on every bar of history (Pine’s last_bar_index). It grows as new bars arrive; bars already run keep the value they saw.
Time
The open time of this stream’s newest bar, known on every bar (Pine’s last_bar_time).
boolean
True once the run has reached live data.
(n: number): BarView
The bar n bars ago on this stream; ago(0) is the current one. Fields are na before the first bar.
BarView
The developing bar of this stream, read from another stream’s handler. It changes until the bar closes (it repaints), which is why it has to be asked for by name.
(handler: () => void): void
Runs for every bar of history, once, and again on every update of the forming bar.
(handler: () => void): void
Runs once when a bar closes, after its last onBar.

trades()

Trade

One trade (a taker fill), with the identities 0xArchive records.
Time
number
number
number
price × size, in USD.
'buy' | 'sell'
The taker’s side.
string | null
string | null
The taker’s order id: fills with the same id are one order.
string | null
Wallet addresses, lower-case hex, when the source carries them.
string | null
boolean
True when the taker was being liquidated.
boolean
True when the same taker order filled the trade before this one on the stream (time order, execution order within a millisecond), filters such as minSize aside. False where the source does not say. Join fills into orders with it when takerOrderId is null.
number
The trade’s change in the venue’s open interest, in the market’s base unit, from both sides’ positions before it: positive where it opened positions, negative where it closed them, 0 where one side opened and the other closed. Hyperliquid and HIP-3 count both sides of open interest, Lighter longs only, as each venue’s own open interest does. na where the venue does not know.

TradesOptions

string
Venue
number
Skip trades smaller than this, in base units or in USD.
number

Trades

(handler: (trade: Trade) => void): void
Runs once per trade, in execution order, before the onBar of the bar it falls in.
boolean
Whether trades cover the current bar completely. Trade history is limited, so older bars have none.

liquidations()

Liquidation

Time
number
number
number
'long' | 'short'
The side of the position that was liquidated.
string | null

Liquidations

(handler: (liquidation: Liquidation) => void): void
boolean

derivatives()

Derivatives

Perp state as of the current bar: the last sample at or before it. na when unknown.
Time
When the sample read was taken; na when there is none.
number
number
number
The funding rate for one hour, as a fraction (0.0001 is 0.01%).
number
number
number
boolean

breadth()

Breadth

The share of a venue’s markets trading above their session VWAP, as of the current bar.
number
Percent, 0 to 100.
number
number
How complete the sample is: the percent of the venue’s markets that had data for it, 0 to 100.
Time
When the sample read was calculated; na when there is none.
boolean

depth()

Depth

Resting size in the book near the price, as of the current update.
(bandPct: number): number
Total resting bid and ask size within bandPct percent of the mid. bandPct must be one of the declared bands.
(bandPct: number): number
number
number
number
number
Time
When the sample read was taken; na when there is none.
boolean
Book views have no history until the terminal serves one; before that only live bars have them.

orderBook()

BookBand

A band around the mid, in basis points: 10 is 0.1%, 1000 is 10%.

BookStat

avg, the default: the time-weighted mean over the bar. close: the book at the bar’s end.

OrderBook

The full-depth order book over each of the chart’s bars (Hyperliquid and HIP-3, from 2026-03-10): from 0xArchive’s book archive, and for the newest hour from the page’s live book. A bar the book was not known for reads na, never 0. Live, the page holds up to 400 levels a side, so a band that reaches past them reads na until the archive has the hour.
(options?: { stat?: BookStat }): number
Mid price.
(options?: { stat?: BookStat }): number
Best ask less best bid over the mid, in basis points.
(options?: { stat?: BookStat }): number
Size resting at the best bid and the best ask (the best queues), in contracts.
(options?: { stat?: BookStat }): number
(band: BookBand, options?: { usd?: boolean; stat?: BookStat }): number
Resting size within band of the mid on one side: in contracts, or in USD with usd: true.
(band: BookBand, options?: { usd?: boolean; stat?: BookStat }): number
(band: BookBand, options?: { stat?: BookStat }): number
Bids less asks over their sum, in USD within band: -1 (all asks) to 1 (all bids).
(usd: 10000 | 100000 | 1000000): number
What a market order of usd pays against the mid at the bar’s end, in basis points; na when the book cannot fill it.
(usd: 10000 | 100000 | 1000000): number
number
Price levels on each side at the bar’s end; na live.
number
number
The share of the bar the book was known, 0 to 1.
boolean
True when any of the bar came from the live book rather than the archive.
Time
The bar’s open time; na when there is no reading.
boolean

openInterest()

OpenInterest

Open interest over each of the chart’s bars, from 0xArchive’s one-minute open interest (Hyperliquid from 2025-03-01, HIP-3 and Lighter from their own starts). A bar opens at the close of the minute before it, so close - open is its whole change; its high and low are over its minutes. In the market’s base unit, or USD with { usd: true } (each minute’s open interest times its mark). The newest bars are built from the trades instead: each trade’s change in open interest (Trade.oiDelta), summed and anchored to the one-minute open interest, so the forming bar moves with every trade and each bar closes where its last trade left it. On time bars of a minute or more that is every bar since the hour before the chart opened; on seconds bars and bars that close on trades (tick, volume, range and the rest) it is every bar, as far back as the trades reach (trades(): today and the two UTC days before). USD there is each level times the price of the trade that set it.
(options?: { usd?: boolean }): number
(options?: { usd?: boolean }): number
(options?: { usd?: boolean }): number
(options?: { usd?: boolean }): number
(options?: { usd?: boolean }): number
The bar’s change, close less open. In USD it is the change in coins at the bar’s closing mark, so it counts positions opened and closed, not the price moving the ones already open.
Time
The bar’s open time; na when there is no reading.
boolean

funding()

Funding

The funding rate over each of the chart’s bars, from 0xArchive’s one-minute funding readings (Hyperliquid from 2025-03-01, HIP-3 and Lighter from their own starts). A bar’s rate is the venue’s rate at its last minute: on Hyperliquid the predicted rate for the hour then running, which is what settles at the hour’s end, so a 1h bar holds the rate its hour paid. Positive: longs pay shorts. The forming bar moves as each minute closes, about 1 to 4 minutes behind. Only time charts of whole minutes, 1m or longer, have it: on seconds, tick, volume and range bars every value is na.
(options?: { hours?: number }): number
The rate as a fraction per hour, as the venues pay it, or per hours hours (8 for an eight-hour rate, 8760 for a year’s).
number
The premium at the bar’s last minute, the mark’s distance from the oracle the rate is built from; na on Lighter.
Time
The bar’s open time; na when there is no reading.
boolean

liquidationLevels()

Where open positions would be liquidated, from 0xArchive’s liquidation levels.

Level

A price level with resting size on each side, such as a liquidation or stop cluster.
number
number
USD notional that would trade if price reached the level: long and short positions, or buy and sell orders.
number

Levels

(): readonly Level[]
The levels as of the current bar, sorted by price. Empty when unknown.
Time
When the snapshot read was taken; na when there is none.
boolean

triggers()

Resting stop and trigger orders by price, where the data exists.

sessions

Exchange session calendars for HIP-3 stock and commodity perps (src/browser/market-calendars.mjs).
(market: string): string | null
The calendar id for a market, such as nyse, or null for markets that trade around the clock.
(calendar: string, time: Time): { readonly open: boolean; readonly regular: boolean; readonly start: Time; readonly end: Time }
Whether calendar is in session at time (regular or extended hours), with that session’s bounds; when closed, start is the last close and end the next open. regular says whether the session is the regular one. Holidays and early closes included.

Next step

Continue with State.
Last modified on October 16, 2026