π¦Liquidation and Margin Details
This section deals with how the Liquidation price of a position is calculated with an example.
Last updated
This section deals with how the Liquidation price of a position is calculated with an example.
Last updated
Liquidation on the ZKX exchange is an automated mechanism that ensures the financial stability and integrity of the platform by preventing excessive losses that could affect the overall liquidity of the platform. It occurs when a trader's margin balance is insufficient to support their leveraged positions.
When a trader engages in leveraged trading on the ZKX exchange, they are essentially borrowing funds to increase the size of their position. This practice can amplify profits but also magnify potential losses. To manage this risk, ZKX requires traders to maintain:
A minimum margin balance, known as the Initial Margin(IM), IM is determined by the size of the position, its opening price, and the leverage used. (Check tables below.)
ZKX has set a Maintenance Margin Fraction (MMF) that defines the percentage of the position's value needed to keep it open. It's the threshold below which the trader's position becomes at risk of liquidation. Currently, it is set at a constant value for each market 0.075 %. Refer to the section MMF in the table below.
If market volatility causes the value of the Open position to drop, the exchange triggers a liquidation process to close the position and protect the system from further losses.
Mark Price is used in calculating liquidations. Also, we use Mark Price for any conditional order execution/trigger. We model Mark Price as fair and tamper-resistant. For more information check the Pricing section in docs.
The liquidation process takes into account the unrealized profit and loss (UPnL) of a position, the current leverage, and position size to arrive at the liquidation price β the specific price level at which liquidation is triggered. This price is calculated based on the initial margin, the maintenance margin requirements, UPnL, and the direction of the trade (long or short). Check the liquidation price formula and illustration in the table.
The goal of ZKXβs liquidation policy is to maintain market stability and ensure traders can manage risk effectively. So we share some portion of this liquidation revenue with token stakers and the rest is transferred to our Insurance fund to manage and mitigate risk.
For further information and calculations, refer to the tables given below.
Description | Const | Formula | Example |
---|---|---|---|
Field | Description | Variable | Formula | Example. Position 1, Long | Example. Position 2, Short |
---|---|---|---|---|---|
Field | Variable | Formula | Example |
---|---|---|---|
Field | Variable | Formula | Example |
---|---|---|---|
Current balance
Balance
-
1000 USDC
Initial Margin Fraction, in percentage
MMF
A constant value for each market
0.075 %
Postion
A direction of a position: Long or Short
Dir
Long = 1 ; Short = -1
Dir = 1 (Long)
Dir = -1 (Short)
Position Size
Quantity of contract in position
Q
Input parameter
Q = 2
Q = 6
Avg Execution Price (avgExecutionPrice)
Average price paid to enter the position
OpPr
Input parameter
OpPr = 1000
OpPr = 100
Leverage
Current leverage of the position
Lev
Input parameter
Lev = 5
Lev = 2
Current Market price
Current Price
Price
Input parameter
Price = 1200
Price = 110
Initial Margin
Initial Margin
IM
Maintenance Margin
Maintenance Margin
MM
Unrealized Profit and Loss
Unrealized profit and LLoss of position
UPnL
Liquidation
Liquidation Price
Total positions count
Count
-
Count = 2
Total Initial Margin
TotalIM
Total maintenance margin
TotalMM
Total Unrealised PnL
TotalUPnL
\begin{equation} TotalUPnL = 200 + (-10) = 190 \end{equation}
Total Margin
TotalMargin
Available Margin
AvailableMargin
\begin{align*} \text{AvailableMargin} &= 1190 - 700 \\ &= \boxed{490} \end{align*}
Max withdrawable Balance
MaxWithdraw
Buying Power
BP
Total Margin
Equity
Margin Usage %
MarginUsagePer
Invested funds
Invested
*OpPr changed to Price