> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data and timeframes

> Read other intervals and markets, 0xArchive's trades, liquidations, order book, open interest, funding and breadth, with no lookahead.

Read more than the chart's own bars. Every kind of data 0xArchive records is a stream a script declares at the top, and every stream reads as of the bar being run, so history never sees the future.

## Streams

| Stream | What it gives, and how far back |
| - | - |
| `bars()` | Bars of any market and interval: the chart's own as loaded, another from 300 of its bars before the chart's first, at most 5,000 |
| `trades()` | Every trade with its side, size, order and change in open interest; today and the two UTC days before |
| `liquidations()` | Every liquidation with its side and the account liquidated: a wallet on Hyperliquid; the last 7 days |
| `liquidationLevels()` | Where open positions would be liquidated, 40 levels over 10% either side of the mark, about every 5 minutes; Hyperliquid, the last 7 days |
| `orderBook()` | The full-depth book over each bar: mid, spread, size and USD within 0.1% to 10%, imbalance, slippage; Hyperliquid and HIP-3 from 2026-03-10 |
| `depth()` | Resting size within bands of the live book the page shows; live only |
| `openInterest()` | Open interest over each bar, open, high, low and close; Hyperliquid from 2025-03-01, HIP-3 and Lighter from their starts |
| `funding()` | The funding rate over each bar; time bars of 1m or longer |
| `derivatives()` | Open interest, funding, mark, oracle and premium from 5-minute samples; the last 14 days |
| `breadth()` | The share of a venue's markets above their session VWAP; perps from 24 Aug 2026, HIP-3 from 28 Aug 2026 |

Anything a stream does not have reads `na`, `null` or `available: false`, never a guess. Each stream's fields are in the [reference](/terminal/reference/streams).

## Other markets and intervals

`bars({ market, interval, venue })` reads another market, another interval, or both. Give it a handler of its own when there is something to calculate on its bars:

```ts theme={"theme":"github-dark"}
indicator('4h EMA', { overlay: true });

const chart = bars();
const h4 = bars({ interval: '4h' });
const ema = ta.ema(20);
const line = plot.line('4h EMA', { width: 2 });

h4.onBar(() => {
  ema.update(h4.close);
});

chart.onBar(() => {
  line.set(ema.confirmed);
});
```

`ema.confirmed` is the EMA as of the last closed 4-hour bar, so the line steps once per 4 hours and draws the same on history as it did live. Intervals are `1m` to `1w`, calendar months `1M` to `12M` (capital M; `1m` is a minute), and bars that close on trades: seconds (`s15`), trade counts (`t500`), volume (`v1000000`), delta, range, renko and reversal. Weeks open on Monday 00:00 UTC.

## As of: no lookahead

Inside a handler, every stream other than the handler's own reads its last confirmed value at or before the current moment: just before the bar's close in history, and the newest data live. A 4-hour bar that closes with the last 1-hour bar of its span is visible on that 1-hour bar, as Pine's `request.security` with lookahead off shows it.

The one way to read a bar still forming is to ask for it by name, `.forming`:

```ts theme={"theme":"github-dark"}
chart.onBar(() => {
  const developing = h4.forming.close;
});
```

Live, `forming` is the developing bar, which changes until it closes: it repaints. On history it is the last closed bar, so history still never looks ahead.

## The forming bar

The chart's newest bar runs again on every update, each time from the last commit: `confirmed` is false, every `state.bar` value is back where the last closed bar left it, and only the latest run's output is drawn. When the bar closes, `onBar` runs once more with `confirmed` true, then `onClose`. Do something once per bar in `onClose`; do something that should follow the price live in `onBar`.

## Events: trades and liquidations

`trades()` and `liquidations()` deliver events to `onTrade` and `onLiquidation`, in execution order, before the `onBar` of the bar they fall in. Sum them into [tallies](/terminal/guides/state#tallies) and read the tallies in the chart's handlers; see [order flow](/terminal/guides/order-flow) and [liquidations](/terminal/guides/liquidations). `available` says whether the stream covers the current bar completely: older bars than its history have none.

## Sample streams

`orderBook()`, `openInterest()`, `funding()`, `derivatives()`, `breadth()`, `depth()` and `liquidationLevels()` have no handlers. Read them in any handler; each gives its value as of that moment, or `na` with `available: false` when there is none.

```ts theme={"theme":"github-dark"}
const oi = openInterest();

chart.onBar(() => {
  if (!oi.available) return;
  oiChange.set(oi.change({ usd: true }));
});
```

## Next step

Read every trade in [order flow](/terminal/guides/order-flow).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.