Perpetual Protocol

Intro to liquidations

Liquidation is a key part of leveraged trading. When you open a leveraged position, in a sense you are using collateral to borrow money from the exchange to purchase an asset.
If the value of that asset (aka your position) falls, your losses begin to approach the value of your margin (ie. your initial collateral). This puts the exchange at risk—a sudden price movement could make your position worth less than your collateral. If the value of your asset is dangerously close to the value of your collateral, the exchange will proactively liquidate your position in order to secure against losses.
For example, if you open a 10x leveraged position using 100 USDC, your total initial position is worth 1,000 USDC—900 USDC of that position's value is borrowed.
Therefore, the exchange enforces a minimum ratio between the position's value and the margin, called a maintenance margin. On Perpetual Protocol, the maintenance margin is 6.25%.
In our previous example, if your position's value drops to 937.5 USDC, it will be liquidated. From this example, it is clear that 10x leverage is very high risk.
Collateral vs. Margin in perpetual contract trading
Collateral is funds you have available for trading and not currently in use. Margin is collateral that is in a currently open position.

Partial liquidations

To make trading safer and more fair, Perpetual Protocol uses partial liquidations.
As long as your ratio between the asset value and the margin (margin ratio) is above 2.5%, only 25% of your position will be liquidated, leaving the rest of your position intact with a margin ratio above the liquidation point.

Liquidation mechanism

Liquidation occurs when your position margin ratio falls to 6.25% or below. This percentage is known as the maintenance margin.
Perpetual Protocol uses a partial liquidation scheme.
Assuming a timely liquidation occurs, 25% of the position’s PnL will be realized and a corresponding portion of the position notional and margin will be liquidated, leaving the remaining position untouched.
⚠️ If the price moves fast than liquidation can occur and margin ratio falls to 2.5% or less, total liquidation will occur.


margin ratio: (margin + unrealized PnL) / positionNotional
liquidation penalty: 2.5% of positionNotional
//1.25% to keeper; 1.25% to insurance fund
Initial conditions
positionNotional = 1000
leverage = 2x
margin = 500
PnL = -440
margin ratio: (500 - 440)/ 1000 = 0.06
assume positionNotional liquidated = 300 //actual amount will depend on x*y=k curve
liquidation penalty: 300*0.025 = 7.5
margin: 500 - (440*0.25) - 7.5 = 382.5
margin ratio: (382.5 - 440*0.75) / (1000 - 300) = 0.075
Liquidation is triggered by keeper bots. As a reward for performing this service, keepers earn 1.25% of the remaining position notional.
Keepers are used with blockchains because smart contracts and blockchains in general are passive and cannot execute code without external triggers. Keeper bots are a decentralized way to accomplish this trigger (anyone can run the bot).
Oracle Based Calculation During Severe Market Conditions
In order to combat flash crash risk, if the mark price diverges more than 10% from the index price (oracle price), liquidations will be evaluated based on oracle price.
This measure provides an additional check against the risk of liquidation during a flash crash if the price on Perpetual Protocol diverges severely from spot prices.