Liquidation
When a position becomes liquidatable, how much is closed, and what it costs.
Liquidation closes part of a position once the collateral behind it stops being enough, and hands that part to whoever will take it on, at a discount that pays them for doing so. Every account is cross-margined, so eligibility is judged on the whole subaccount rather than on any single position. Worked numbers use a $10,000 account with SOL at $100, on illustrative market parameters.
When an account becomes liquidatable
An account is liquidatable when its total collateral falls below its maintenance margin requirement. Total collateral is the weighted value of the account's deposits plus its perpetual P&L; the requirement is the weighted value of its borrows and perpetual positions. The entry test is unbuffered: it compares against the maintenance requirement itself, with no cushion added.
The account health figure on the position page is the same comparison expressed as a percentage:
Health = 100% - maintenance_margin / total_collateralAt 0 health the account is liquidatable. Initial margin is a separate, higher bar governing opening and withdrawing, and it never decides liquidation eligibility. Both ratios are per-market and admin-set; see Market specs and Account health.
What happens first: orders, not positions
Liquidation begins by cancelling the account's open orders. Orders reserve margin, so cancelling them frees some without touching any exposure, and it is common for that alone to be enough: the margin calculation is re-run immediately, and if the account is back above the exit threshold the liquidation stops there with no position transferred.
A fill that would leave the taker below its requirement does not cancel that account's orders. The fill itself reverts with InsufficientCollateral, leaving the orders in place. Cancellation on low collateral happens at liquidation entry, and through a permissionless keeper action that requires the account to be failing its initial margin requirement, skips any order that would reduce a position, and charges a flat fee per order cancelled.
How much gets closed
The target is not the maintenance requirement. Bringing an account back to exactly the line it just crossed leaves it liquidatable again on the next tick, so the engine works toward the requirement plus a buffer of 2% of notional. At a 3% maintenance ratio that makes the exit target 5% of notional against a 3% entry test.
The amount of base transferred is whatever closes the shortage between collateral and that buffered requirement. Each unit transferred frees the buffered margin ratio less the liquidator's fee and less the insurance-side fee, since those fees come out of the same collateral.
The throttle
Sizing decides how much needs to move. A second cap decides how much may move right now: a ramp that starts at a configured percentage of the shortage when the account enters liquidation and climbs to 100% over a configured duration. Two shortcuts bypass it entirely. A margin shortage below $50 is fully freeable at once, and a position whose base asset value is $50 or less may be taken in full.
Both the duration and the initial percentage are admin fields on the market, changeable without a program upgrade. At a duration of zero the throttle is inert and the whole computed amount is available on the first fill; above zero, the freeable fraction starts at the initial percentage and climbs to 100% across the duration. Read the live values rather than assuming either state.
Price: oracle, and only when the oracle is believable
The transfer price is the oracle price, not the mark price, so a liquidation cannot be triggered or priced by pushing the book around. Before any position moves, the live oracle is compared against the market's five-minute oracle TWAP, and if they diverge by 50% or more the liquidation is rejected with PriceBandsBreached.
That 50% is a floor rather than a setting: an admin can tighten the guard, but the program will not liquidate through a wider divergence in any configuration. The block is temporary, and normal liquidation resumes once the deviation narrows. See Oracles and Guard rails.
What it costs
Three per-market rates come off a perpetual liquidation, all against the transferred notional.
- The liquidator fee is the discount that makes taking on the position worth doing.
- The insurance fund fee is credited to the liability market's revenue pool.
- The protocol liquidation fee goes to the withdrawable protocol fee pool, and takes nothing while it is zero.
All three are admin-set per market and all three initialize to zero, so read them off the live market account.
The insurance-side budget is split insurance fund first, so a protocol cut can never push a liquidation into a bankruptcy that would not otherwise have happened; it only reduces the excess margin the liquidatee keeps.
The liquidator fee ages. After a grace period of 600 seconds from the moment the account entered liquidation, the effective liquidator fee rises by 0.01 bps per 400 ms of further elapsed time, capped at the lesser of three times the base fee and the market's maintenance margin ratio. At a 0.75% base fee and a 3% maintenance ratio that cap is 2.25%, and reaching it takes roughly 100 minutes past the grace window.
Worked example
Illustrative market parameters: a 3% maintenance margin ratio, a 0.75% liquidator fee, a 0.75% insurance fund fee, and a protocol liquidation fee of zero.
The $10,000 account deposits $10,000 of USDT and goes long 1,000 SOL-PERP at $100, a notional of $100,000 and 10x leverage.
Where it becomes liquidatable. Collateral is $10,000 plus P&L; the maintenance requirement is 3% of the live notional. They meet at $92.78, a drop of 7.22%, where collateral is $2,780 against a requirement of $2,783.
What the engine targets. Not $2,783. With the 2% buffer the exit target is 5% of notional, $4,639, so the shortage to close is $1,859.
How much position that takes. Each SOL transferred frees the 5% buffered ratio less the 0.75% liquidator fee and less the 0.75% insurance fee, so 3.5% of $92.78, or $3.25 per SOL. Closing a $1,859 shortage takes 572.5 SOL, rounded up to the market's 0.01 SOL step size. That is 57% of the position, a transferred notional of $53,116.
What it costs. The liquidator pays oracle less 0.75%, earning $398. The insurance fund takes another $398. At a protocol fee of zero the protocol takes nothing.
Where it stops. The account keeps 427.5 SOL, a notional of $39,663, and collateral of $2,780 less $797 of fees, or $1,983. The buffered requirement on what remains is also $1,983, so the account clears the exit test, the flag is cleared, and it can place orders again. It kept 43% of its exposure.
Where the throttle would bite. The $1,859 shortage is well above the $50 shortcut, so at a throttle duration of zero all 572.5 SOL clears on the first fill. At a duration of 60 seconds with an initial percentage of 10%, the first fill would be capped at roughly 57 SOL, climbing to the full amount over the following minute.
Being a liquidator
Liquidation is permissionless, and it is a position transfer between accounts, so a liquidator has to be collateralized well enough to satisfy the initial margin requirement of the position it takes on. The reward is credited to its Velocity account rather than paid out separately. See Liquidation bot.
When liquidation is not enough
If a liquidation leaves an account with an outstanding liability and no remaining assets, it is bankrupt, and the shortfall is absorbed by a defined sequence of sources before anything is socialized. See Liquidation and bankruptcy for the tranche order and Insurance fund.
What this means in practice
For a leveraged account, the number that matters is the maintenance ratio, not the initial one, and the distance between them is the entire margin of safety. Opening at the initial limit means the first adverse tick is also the liquidation.
A liquidated account usually keeps part of the position. The engine closes what it needs to reach the buffered requirement and stops, and open orders are cancelled before any position moves.
For a liquidator, the throttle duration and initial percentage come from program state rather than from an assumption, and the liquidator fee only begins aging 10 minutes after entry.