Liquidations
Liquidations are automatically triggered when a trader's margin falls below the cumulative maintenance margin requirement across all open positions. This can occur due to mark price updates or funding charges that reduce the account's available margin below the cross-margin threshold.
When a liquidation is triggered, the matching engine performs a complete account takeover, transferring all positions to the liquidator at the bankruptcy price. The liquidator then unwinds these transferred positions over time. This mechanism protects both individual traders and the broader system from cascading insolvency risk.
Insurance Fund & Liquidator Account
The insurance fund is a capital reserve that absorbs any loss that remains after a liquidation. The liquidator account is the insurance-fund account itself. All liquidated positions are transferred here and unwound asynchronously. Profits stay in the fund and losses are covered by it.
Core Concepts
Initial margin – the minimum collateral required to open a position.
Maintenance margin – the minimum equity required to keep positions open.
Liquidation price – the mark price from Pyth Lazer that triggers liquidation.
Bankruptcy price cap – the mark price at which an account’s equity would be exactly zero.
Liquidation Triggers
The matching engine reevaluates every account at each MarkPriceUpdate
(once per second) and at every FundingCharge
event. If equity falls below maintenance margin the account is flagged.
First Bankruptcy Price
At every oracle update the engine finds the first price at which any account’s equity would hit zero. That price becomes a cap for valuation. If Pyth later prints a deeper price, the cap is used instead, preventing negative equity and limiting damage from stale or bad data.
Liquidation Process
Cancel all open orders on the flagged account.
Full-account takeover – Ethereal does not use partial liquidations.
Transfer every position to the liquidator account at the bankruptcy price.
Set the trader’s margin balance to zero and record the action onchain.
The liquidator places reduce-only orders to unwind the positions.
Surplus PnL is added to the insurance fund.
Deficit PnL is covered by the fund.
Liquidations initiated by a funding charge are possible but rare because funding runs hourly and accounts must already be close to maintenance margin.
Margin Requirements
With the default 50× leverage, initial margin is 2 percent and maintenance margin is 1 percent.
Liquidation-Price Calculation
Account equity equals required margin at liquidation.
Long Position
Example – balance 10k USD, long 1 BTC at entry 83k, maintenance 1% Liquidation price = (83000 - 10000) / 0.99 = 73737
Short Position
Example – balance 10k, short 1 BTC at entry 65, maintenance 1% Liquidation price = (65000 + 10000) / 1.01 = 74257
Onchain Verification
A LiquidateSubaccount
action is submitted to the ExchangeGateway
. Smart contracts:
Check that the mark price is recent (not older than the staleness tolerance).
Confirm positions and sizes match the engine output.
Recompute equity with the verified oracle price and ensure it is below maintenance margin.
If any check fails the transaction reverts and the liquidation is cancelled.
Last updated