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

# Liquidations

> Liquidated USD per bar, longs below zero and shorts above, optionally for chosen wallets only.

<Frame caption="BTC on 1-hour bars in the 0xArchive Terminal, 2026-10-15.">
  <img src="https://mintcdn.com/0xarchive-e895b8e7/_p6Z1TtSEb5DBnPX/images/terminal/examples/liquidations.webp?fit=max&auto=format&n=_p6Z1TtSEb5DBnPX&q=85&s=f301d091d0d145c2aadbb38d68c82f5e" alt="Liquidations on a BTC chart" width="1038" height="664" data-path="images/terminal/examples/liquidations.webp" />
</Frame>

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

Liquidated USD on each bar: longs as bars below zero, shorts above. Paste wallet addresses into **Only these wallets** to see only theirs, which works on Hyperliquid, where every liquidation names its wallet.

## How it works

Two [tallies](/terminal/guides/state#tallies) collect each bar's liquidations by side. `input.addresses` gives the settings panel a wallet list, which keeps only valid addresses, lower-case.

Liquidations reach back 7 days.

## The script

```ts liquidations.ts theme={"theme":"github-dark"}
// Liquidated USD per bar: longs below zero, shorts above. Optionally only some wallets' (Hyperliquid names the liquidated wallet).
indicator('Liquidations', { precision: 0 });

const minUsd = input.float('Smallest ($)', 0, { min: 0 });
const wallets = input.addresses('Only these wallets', []);

const chart = bars();
const liq = liquidations({ minNotional: minUsd });
const longs = tally();
const shorts = tally();

const longBars = plot.histogram('Longs liquidated $', { precision: 0 });
const shortBars = plot.histogram('Shorts liquidated $', { precision: 0 });

liq.onLiquidation((l) => {
  // On Lighter the liquidated account is an index, which no wallet matches.
  if (wallets.length > 0 && !(l.user !== null && wallets.includes(l.user.toLowerCase()))) return;
  (l.side === 'long' ? longs : shorts).add(l.price * l.size);
});

chart.onBar(() => {
  if (!liq.available) return;
  longBars.set(-longs.value, color.down);
  shortBars.set(shorts.value, color.up);
});
```

## Next step

See the next example, [Liquidation clusters](/terminal/examples/liquidation-clusters).


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