How liquidation works on PerpNow
A code-based guide to PerpNow maintenance margin, liquidation, backstop and ADL.
Updated 2026-11-05
Equity and maintenance
PerpNow compares account equity with maintenance requirements during block processing. Cross positions share account collateral; isolated positions are evaluated with their position-specific margin and unrealized PnL. For each market, maintenance is position notional divided by twice that market's maximum leverage. The engine values risk at its risk price, which normally uses mark price and falls back to oracle when the mark is unavailable. The mark price also drives unrealized PnL and liquidation orders.
A risk sweep evaluates accounts affected by an oracle update or by changes in the block. When equity drops below maintenance, the engine begins reducing exposure. This is a risk-control process, not a promise that a position can always be closed at a particular price. Read the margin and liquidation docs and inspect committed actions in Explorer.
Market liquidation
Before liquidation orders are created, ordinary open orders for the affected position are removed so that stale orders do not increase exposure while the account is under maintenance; conditional trigger orders are skipped. The engine submits reduce-only IOC orders into the order book. Reduce-only means the order can shrink the existing position but cannot flip it into a larger position; IOC attempts an immediate fill and cancels any remainder.
When the position notional is above $100,000, the first pass reduces at most one fifth of the position quantity and starts a 30-second cooldown. Positions at or below $100,000 notional are attempted in full. Remaining collateral, execution prices and book liquidity affect the result.
Backstop and auto-deleveraging
If equity is non-positive after market liquidation, the risk path can proceed directly to auto-deleveraging (ADL). Otherwise, when equity falls below two thirds of maintenance, the liquidator backstop may take the remaining position at the risk price. If that transfer cannot be applied, the engine can use ADL to close opposing positions.
ADL examines opposing positions and prioritizes eligible accounts with positive position value, unrealized PnL, entry notional and current notional; eligible positions rank ahead of ineligible ones, with a profitability-and-leverage score and deterministic account-index tie-break. If no eligible candidate is available, the code can still proceed through the remaining opposing positions. Transfers execute at the risk price. If the liquidated account has a deficit after positions close, the deficit is allocated among counterparties using notional weights and a deterministic largest-remainder calculation. This is a loss-sharing mechanism, not insurance against loss.
These stages are conditional. A position can be reduced through the book without reaching the backstop, and an account with sufficient equity is not liquidated merely because price moved. Isolated positions are checked independently; cross positions are assessed together against account collateral. In either case, maintenance is a threshold; fees, funding, price changes, available liquidity and block ordering can affect realized results.
Open orders matter because they can consume margin or add exposure. Cancelling them before sending reduce-only IOC orders helps prevent liquidation from competing with stale user orders. IOC orders can still fail to fill fully when the book has insufficient liquidity at eligible prices. After a pass, a large position may remain open until a later eligible risk evaluation; the amount and timing depend on account state and available liquidity.
Interpreting an Explorer record
Explorer can show liquidation transactions and associated block information. Compare the transaction with the resulting position and account state rather than inferring the complete outcome from a single order event. A partial market liquidation, a backstop transfer and ADL are different events. When a deficit is shared, the engine's apportionment is based on the notional weights of the counterparties that were closed and uses deterministic tie-breaking so validators reach the same result.
Do not rely on the $100,000 partial-liquidation threshold or a leverage setting as a substitute for monitoring risk. The threshold determines how much of a position is attempted in a pass, while maintenance depends on the market maximum leverage and current notional. The testnet helps inspect these rules, while execution quality and loss outcomes can differ across environments.
What traders should monitor
Check position equity, mark price, leverage and open orders rather than relying only on last trade. Cross collateral can support several positions but also exposes shared account equity; isolated margin confines the margin pool to a market position. Reduce exposure or add eligible collateral before equity approaches maintenance. PerpNow is a testnet with test funds only, so use it to understand mechanics rather than to infer production execution outcomes.
For the underlying API, see Docs. Compare cross and isolated margin, review funding, or open BTC perpetuals.