> ## 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.

# Open interest footprint

> Where open interest was built and where it was unwound, at each price, from each fill's change in open interest.

<Frame caption="BTC on 1-minute bars in the 0xArchive Terminal, 2026-10-17.">
  <img src="https://mintcdn.com/0xarchive-e895b8e7/l09H5bMMUN4iGB-K/images/terminal/examples/open-interest-footprint.webp?fit=max&auto=format&n=l09H5bMMUN4iGB-K&q=85&s=faaf5579fd99605028d53dd0a7b06b0a" alt="Open interest footprint on a BTC footprint chart" width="1038" height="664" data-path="images/terminal/examples/open-interest-footprint.webp" />
</Frame>

<Card title="Open on a chart" icon="chart-candlestick" href="https://terminal.0xarchive.io/?symbol=BTC&interval=1m&scripts=example%3Aopen-interest-footprint" horizontal>
  Load it on BTC 1m in the terminal, then change its settings or open it in the script editor.
</Card>

At each price, how much open interest the trades there **built** (blue, right) and **unwound** (amber, left). Stopped-out longs unwind open interest at the lows; new shorts build it just above them. The colours are neither buy nor sell, since either side can do both. The **Net** row under each bar is built less unwound.

## How it works

Every fill on Hyperliquid, HIP-3 and Lighter carries [`oiDelta`](/terminal/guides/order-flow#opening-and-closing-trades), its change in the venue's open interest. A lane holds amounts above 0, so the script splits the signed value into two lanes. A fill whose change is 0 (one side opened while the other closed) moves neither.

## Try changing

* Change the stats to `['built', 'unwound']` to drop the Net row.
* Read only the larger trades with `trades({ minNotional: 50_000 })`.

## The script

```ts open-interest-footprint.ts theme={"theme":"github-dark"}
// Where open interest was built and where it was unwound, at each price: each fill's `oiDelta`, its
// change in the venue's open interest. Built is blue on the right and unwound amber on the left, so
// neither reads as buying or selling; the Net row under each bar is built less unwound.
indicator('Open interest footprint', { overlay: true, shortName: 'OI footprint' });

const tape = trades();
const fp = plot.footprint('Open interest change', {
  lanes: [
    { id: 'unwound', label: 'Unwound', side: 'left', color: '#e0a33a' },
    { id: 'built', label: 'Built', side: 'right', color: '#4f9cf0' },
  ],
  stats: ['unwound', 'built', { net: ['built', 'unwound'], label: 'Net' }],
});

tape.onTrade((t) => {
  // `na` where the venue does not know; 0 where one side opened and the other closed.
  const oi = t.oiDelta;
  if (isNa(oi) || oi === 0) return;
  if (oi > 0) fp.add('built', t.price, oi);
  else fp.add('unwound', t.price, -oi);
});
```

## Next step

See the next example, [Makers opening footprint](/terminal/examples/makers-opening-footprint).


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