Formula Breakdown
We have a minimum margin requirement of 3%, which takes into account trading fee, liquidation fee, and possible market slippage. This means even if you are on a 1x position, you will still see a liquidation price.
Key Definitions:
- maintenanceMarginRate:
0.03
(or 3%) – the minimum margin requirement. - accountLeverage:
totalPositions / totalBalance
– determines the leverage used by the trader. - averagePrice:
position / positionQuantity
– the average entry price for the position.
Liquidation Price Formulas
Position Type | Formula |
---|---|
Long | max(averagePrice × (1 - 1/accountLeverage + maintenanceMarginRate), 0) |
Short | averagePrice × (1 + 1/accountLeverage - maintenanceMarginRate) |