Liquidations that happened
liquidations() delivers each liquidation to onLiquidation: time, price, size, notional, side (the side of the position liquidated, 'long' or 'short') and user, the account. On Hyperliquid user is the wallet, lower-case; on Lighter it is an account index. Liquidations reach back 7 days.
When a bar is complete
available is true once the bar’s liquidations are all in. It says the bar is complete, not that the feed is healthy: liquidations arrive a little after the trades that caused them, so a closed bar waits for its own before it runs. Bars older than the 7 days of history read false, and the forming bar reads true once everything before it is in.
- On the chart’s own market, liquidations are complete to about 2 seconds before now, and a closed bar waits that long. The live feed opens with the last few minutes of liquidations, so once it has joined the history this holds within moments of the chart loading, reconnecting or switching market. When the live server holds fewer minutes (just after it restarts, or after a loss in its own feed), the stream reads
delayeduntil the history reaches them, a few minutes at most. - A market other than the chart’s has no live feed: its liquidations are complete only as far as the history has reached, a few minutes behind. A closed bar waits for that too, for up to 10 minutes.
- Past the wait (3 minutes with the live feed joined), a bar runs with
availablefalse. Once its liquidations arrive, the script runs again from its first bar, so that bar and everything after it update. Alerts fire only on bars run live, not on that re-run.
liq.coveredTo is the time the liquidations are complete to, and liq.state how the stream stands:
Both describe the stream now, not as of the bar being run, so read them on the newest bar. A covered bar with no liquidations reads
available true and an empty tally, so write na rather than 0 while a bar is pending:
Follow wallets
input.addresses gives the settings panel a wallet list, which keeps only valid addresses, lower-case. Skip the others in the handler:
Where liquidations would happen next
liquidationLevels() is 0xArchive’s estimate of where open positions would be liquidated: 40 levels over 10% either side of the mark, each with the USD of longs and of shorts liquidated there, about every 5 minutes. Read it in any handler; levels() is the snapshot as of that bar, sorted by price.
autoscale: false so they are drawn where they fall without moving the scale. Liquidation levels ahead and Liquidation clusters draw them.