Partial Liquidation
- USDT Teminatlı Futures Rehberi
What is Liquidation?
Margin ratio is an indicator to estimate the risk of users’assets. When the margin ratio is less than or equal to 0%, liquidation will be triggered. It is recommended that you pay close attention to margin ratio changes, so as to avoid your positions from liquidation.
HTX USDT-margined contracts implement a partial liquidation mechanism, in which the system will lower the corresponding tier of an adjustment factor to avoid your positions from being liquidated at one time.
Isolated Margin Mode: Margin Ratio = (Account Equity / Occupied Margin ) * 100% – Adjustment Factor
Note: Occupied Margin =Position Margin + Frozen Margin
Assume liquidation is triggered when the adjustment factor of a user’s position belongs to tier 1:
1. The system will cancel all open orders of this contract;
2. The long and short positions will be filled with that of the same contract (self-trade)
3. If the margin ratio is still less than 0, all the position will be liquidated.
Assume liquidation is trigged when the adjustment factor of a user’s position is greater than tier 1:
1. The system will cancel all open orders of this contract;
2. The long and short positions will be filled with that of the same contract (self-trade);
3. If the margin ratio is still less than 0, the system will reduce the positions to the upper limit of a certain tier, so as to decrease the adjustment factor and make the margin ratio greater than 0.
4. If the margin ration fails to exceed 0% after the system reduces the positions and makes the adjustment factor decrease to tier 1, all positions will be liquidated.
- When the liquidation is triggered, the user cannot proceed any operation relating to this contract.
Cross Margin Mode: Margin Ratio = Account Equity / ∑All Contracts in the Cross Margin Account (Occupied Margin * Adjustment Factor) – 100%
Note: Occupied Margin = Position Margin + Frozen Margin
In the cross margin mode, all USDT-margined contracts (including swaps and futures) share the same account equity. If the margin ratio is less than or equal to 0%, liquidation will be triggered, and there is a risk of liquidation for all positions of various types of contracts in this mode. If liquidation is indeed triggered for a cross-margined position, then:
1.The system will cancel all open orders of all contracts in the cross margin account;
2.The long and short positions of the same trading pair under the same contract type will be self-traded;
3.If the margin ratio is still less than or equal to 0, the system will sort all the positions of all contracts in the cross margin account from low to high based on the current-period unrealized PnL.
4.To lower the tier of adjustment factor, the system will partially liquidate the positions of a contract with the largest loss until the margin ratio is greater than 0%.
- When the liquidation is triggered, users cannot proceed any operation on any contracts under the cross margin mode.
What is Adjustment Factor?
The adjustment factor is designed to prevent users from extended margin call loss. HTX USDT-margined Contracts use a tiered adjustment factor mechanism, which supports up to five tiers based on the position amount (cont). The larger the use’s net positions, the higher the tier and the greater the risk. Read the article on the adjustment factor of USDT-margined contracts>>>
Take BTC/USDT swaps as an example. Assume Tom’s net position amount is 10,000 conts, belonging to Tier 2, and the adjustment factor for 5x leverage is 6%, for 10x leverage is 12.5%, for 20x leverage is 25%, and for 30x leverage is 35%.
What’s Estimated Liquidation Price?
The estimated liquidation price is an estimated price of a contract when the margin ratio is 0%. In cross margin mode, all USDT-margined contracts share the same margin in the cross margin account and all existing positions of these contracts will be liquidated simultaneously once the margin ratio is 0%, even if the estimated liquidation price varies for different trading pair. This price is for reference only and liquidation will be subject to the margin ratio.
What is Mark Price?
To reduce unnecessary liquidations, USDT-margined contracts use mark price as another reference price for liquidation. That is, when the system determines whether to trigger a liquidation or not, it must satisfy that the margin ratios calculated by the last price and mark price respectively are less than or equal to 0%. Using mark price for the calculation can lower the risk of liquidations caused by several abnormal last prices, which can lead to serial liquidations.
Mark Price Calculation
Mark price of USDT-margined contracts is calculated by taking the median of three prices. USDT-margined swaps take the median among the funding rate basis fair price, the depth weighted fair price, and the latest EMA; While USDT-margined futures take the median of the basis fair price of bid and ask middle price, the depth weighted fair price, and the latest EMA. Please note that the algorithm of the depth weighted fair price is the same as that of the latest EMA.
- ① Funding rate basis fair price
The funding rate basis fair price is a relatively reasonable reference price for USDT-margined swaps, which is calculated based on the current spot index price and the current funding rate basis rate.
Funding Rate Basis Fair Price = Index Price * (1 + Funding Rate Basis Rate)
Funding Rate Basis Rate = Current-period Funding Rate * (Time Interval from Current time to Current-period Settlement Time / Settlement Cycle)
For instance, if the current index price of BTC/USDT swaps is 10,000 USDT, current-period funding rate is 0.01%, it is at 12:00, and the current-period settlement time is 16:00, meaning there are 4 hours to the settlement, and the settlement cycle is 8 hours (settled every 8 hours), then the current funding rate basis fair price = 10,000 * (1+ (0.01% * 4 / 8)) = 10,000.5 USDT.
② Basis fair price of bid and ask middle price
Basis fair price of bid and ask middle price is a relatively reasonable reference price for USDT-margined futures, which is calculated based on the current spot index price and arithmetic mean value of the basis of the bid and ask middle price.
Basis Fair Price of Bid and Ask Middle Price = Index Price + MA (Basis of Bid and Ask Middle Price)
MA ((Basis of Bid and Ask Middle Price) = The Arithmetic Mean Value of the Basis of the latest N Bid and Ask Middle Price; thereinto N=60,
Basis of Bid and Ask Middle Price = (Bid_one Price + Ask_one Price) / 2 – Index Price;
2. Depth weighted fair price
The depth weighted fair price is a relatively reasonable reference price related to current order book depth, which is calculated based on the current spot index price and EMA depth weighted middle price basis.
Depth Weighted Fair Price = Index Price+ EMA (Depth Weighted Middle Price Basis)
- EMA (Depth Weighted Middle Price Basis) = (Current EMA Calculated - Last EMA Calculated) * Factor + Last EMA Calculated;
- Depth Weighted Middle Price Basis = (Depth Weighted Bid Price + Depth Weighted Ask Price) /2 – Index Price;
- The depth weighted bid price refers to the average bid price when the cumulative amount of open orders from bid_one reaches N USDT based on the open orders on current order book. The depth weighted bid price = N USDT / sum (the amount in each tier (coin));
- The depth weighted ask price refers to the average ask price when the cumulative amount of open orders from ask_one reaches N USDT based on the open orders on current order book. The depth-weighted ask price = N USDT / sum (the amount in each tier (coin));
Note: For the value range of N, please refer to the below chart.
3. Latest EMA
Latest EMA refers to the exponential moving average value of the last price of current USDT-margined swaps.
Current Latest EMA = (Last Price – Last EMA Calculated) * Factor + Last EMA Calculated
- The factor = 1 / 3;
To calculate current EMA, Pn represents the last price of No. n
Assume P1 = 10,000;P2 = 10,006;P3 = 10,011; then,
(1) EMA1 = P1 = 10,000;
(2) EMA2 = ( P2 – EMA1 ) * Factor + EMA1 = ( 10,006 – 10,000 ) * 1 / 3 + 10,000 = 10,002;
(3) EMA3 = ( P3 – EMA2 ) * Factor + EMA2 = ( 10,011 – 10,002 ) * 1 / 3 + 10,002 = 10,005;
……
The above EMA will be calculated every 5 seconds, and the formulas are as below:
Mark Price of USDT-margined Swaps = Median (Funding Rate Basis Fair Price, Depth Weighted Fair Price, Latest EMA)
Mark Price of USDT-margined Futures = Median (Basis Fair Price of Bid and Ask Middle price, Depth Weighted Fair Price, Latest EMA)
To avoid unnecessary liquidations caused by abnormal mark price, the system will adjust the mark price accordingly when mark price sharply deviates from the contract price; When mark price exceeds the upper and lower limits of deviation from the last contract price, only the boundary value will be taken.
Mark Price = Clamp (Mark Price, Last Price * (1 + Upper Limit of Deviation Factor), Last Price * (1 – Lower Limit of Deviation Factor))
What is Takeover Price?
Liquidation will be triggered when the last price reaches the liquidation price. The system will take over users’ positions with the takeover price (a price when the user’s account equity is 0). Since the whole process won’t go through the matching system, the takeover price will not be shown on the K-line and the takeover price does not equal to the actual liquidation price.
Example for liquidation in the isolated margin mode:
Assume Tom has 11,000 USDT in isolated-margined BTC/USDT swaps account. He opened a long position of 10,000 conts BTC/USDT swaps (face value: 0.001BTC/cont) at the price of 8,000 USDT. The leverage is 10x, the adjustment factor is 12.5% belonging to tier 2. Without considering the transaction fees, what will happen to Tom’s position when the last price of BTC/USDT swaps reaches 6,987.3 USDT?
Calculate through the following steps:
1. Unrealized PnL.
- Since Tom opened a long position, we use the formula for long positions: Unrealized P/L (Long)= (Last Price – Position Price) * Position Amount (cont) * Contract Face Value
- Therefore, the unrealized PnL = (6,987.3 – 8,000) * 10,000 * 0.001 = –10,127 USDT
- When the last price of BTC/USDT swaps reaches 6,987.3 USDT, Tom’s unrealized PnL is –10,127 USDT.
2. Account Equity in the Isolated Margin Account
- According to the formula: Account Equity = Account Balance + Current-period Realized PnL + Current-period Unrealized PnL
- When the last price of BTC/USDT swaps reaches 6987.3 USDT, the account equity of Tom’s isolated margin account is 11,000 + 0 + (–10,127) = 873 USDT.
3. Position Margin
- According to the formula: Position Margin= (Contract Face Value * Position Amount) * Last Price/ Leverage = = (0.001 * 10,000) * 6,987.3 / 10 = 6,987.3 USDT
- When the last price of BTC/USDT swaps reaches 6,987.3 USDT, Tom’s position margin is 6,987.3 USDT.
4. Whether Liquidation is Triggered or not?
- According to the formula: Margin Ratio = (Account equity/ Occupied Margin) * 100% – Adjustment Factor;
- Therefore, Tom’s Margin ratio = (873 / 6,987.3) * 100% – 12.5% = – 0.005%, at this time, the margin ratio is less than 0%.
- Assume the mark price the system calculated is 6,980 USDT, margin ratio of the mark price = – 1.03%;
- We’ve mentioned above that if the margin ratios calculated by last price and mark price respectively are both less than or equal to 0%, the positions will be liquidated by the system.
- When the last price of BTC/USDT swaps reaches 6,987.3 USDT, liquidated is triggered.
5. What will Happen after Liquidation?
- After the liquidation is triggered, the system detects that Tom's net positions are 10,000 conts and the corresponding adjustment factor belongs to Tier 2. Then the system will try to recalculate Tom’s margin ratio by using the maximum position of the Tier 1, which is 3,999 conts, as the remaining position amount and by using the adjustment factor of Tier 1, which is 7.5%;
- Position Margin = (0.001 * 3,999) * 6,987.3 / 10 = 2,794.2 USDT
- Realized PnL of position that has been taken over = (Takeover Price –Position Price) * Position Amount +Contract Face Value = (6,900 – 8,000) * (10,000 – 3,999) * 0.001 = -6,601.1 USDT;
- Unrealized PnL of positions that have not been taken over (6,987.3 – 8,000) * 3,999 * 0.001 = -4,049.7 USDT;
- Account equity of the isolated margin account= 11,000 + (-6,601.1) + (-4,049.7) = 349.2 USDT;
- Therefore, if Tom only holds 3,999 conts, the margin ratio of his position = (349.2 / 2,794.2) * 100% – 7.5% = 4.99 % > 0%
- At this time, the system will take over 6001 conts (10,000 – 3,999) with the takeover price, the part that exceed the position amount of Tier 1. In this way, Tom’s position is partially liquidated.
6. What is Takeover Price?
- Takeover price is the price when the account equity is 0. Assume the takeover price is X, (X – 8,000) * 10,000 * 0.001 = –11,000 USDT, then X=6,900.
- Therefore, the price that makes the account equity equals to 0 is 6,900 USDT. This is also the price used by the system to take over the position of 6,001 conts swaps, and it will not be displayed on the K-line.
- After the partial liquidation is completed, the remaining positions of Tom is 3,999 conts and all trading will be resumed.
Example for liquidation in the cross margin mode:
Assuming Tom has 33,650 USDT in his cross margin account balance of USDT-margined swaps, and he holds a long position of BTC/USDT swaps, ETH/USDT swaps, and BTC/USDT quarterly futures separately. When the last prices of these contracts fall to 16,000 USDT, 500 USDT and 15,000 USDT separately, what will happen to Tom’s cross margin account?
Contract Type | Face Value | Direction | Leverage | Adjustment Factor | Position Amount | Position Price | Last Price | Unrealized PnL |
BTC/USDT Swaps | 0.001 BTC | Long | 5 | 6.00% | 10,000 | 18,000 | 16,000 | -20,000 |
ETH/USDT Swaps | 0.01 ETH | Long | 10 | 17.50% | 5,000 | 600 | 500 | -5,000 |
BTC/USDT Quarterly | 0.001 BTC | Long | 20 | 15.00% | 3,000 | 17,000 | 15,000 | -6,000 |
Let’s calculate as below according to the margin ratio formulas of cross margin mode:
1. Account Equity
- Based on the formula: Account Equity = Account Balance + Current-period Realized PnL + Current-period Unrealized PnL, we can get that Tom’s account equity in his cross margin account = 33,650 + 0 + (-20,000 – 5,000 – 6,000) = 2,650 USDT;
2. Position Margin
- Based on the formula: Position Margin = (Contract Face Value * Position Amount) * LaST Price / Leverage
- Position margin of BTC/USDT swaps = 0.001 * 10,000 * 16,000 / 5 = 32,000 USDT
- Position margin of ETH/USDT swaps = 0.01 * 5,000 * 500 / 10 = 2,500 USDT
- Position margin of BTC/USDT quarterly = 0.001 * 3,000 * 15,000 / 20 = 2,250 USDT
3. Whether the Liquidation is Triggered?
- Based on the formula: Margin Ratio = Account Equity / ∑All Contracts in the Cross Margin Account (Occupied Margin * Adjustment Factor) – 100%;
- Tom’s current margin ratio = 2,650 / (32,000 * 6% + 2,500 * 17.5% + 2,250 * 15%) - 100% = -1.6%. Currently, the margin ratio of Tom’s cross margin account is less than 0%.
- Assume the margin ratio calculated by using mark price is also less than 0%, the position will be forcibly liquidated by the system.
4. What will Happen after Liquidation?
- After the liquidation is triggered, the system will sort all positions of contracts in Tom’s cross margin account based on their current-period unrealized PnL from low to high.
- After sorting we can find that the position of BTC/USDT swaps has suffered the largest loss and the corresponding adjustment factor belongs to Tier 2. Then the system will use the maximum net positions of Tier 1 as its remaining position amount and use 4%, the corresponding adjustment factor of Tier 1, to re-calculate the margin ratio of Tom’s cross margin account.
- If the margin ratio is still lower than 0% after the position of BTC/USDT swaps was reduced to Tier 1, the system will liquidate all positions of BTC/USDT swaps. And if the margin ratio is still less than 0% after the liquidation of BTC/USDT swaps, by that analogy, the system will continue to liquidate the next position with the largest loss until the margin ratio of Tom’s cross margin account is greater than 0%.
(The above content is for explanation only, the specific settings or related changes shall subject to the latest announcement)
Insurance funds
Insurance funds are designed to cover the losses from forced liquidation.
- Contracts that only support isolated margin mode
For contracts that only support isolated margin mode, there are separate insurance funds for each contract. Assume EOS/USDT and TRX/USDT swaps only support isolated margin mode, then the insurance funds (USDT) of EOS/USDT swaps and those of TRX/USDT swaps are independent.
- Contracts that support cross margin mode
All contracts that support both cross and isolated margin mode share the same insurance funds. For example, if BTC/USDT, ETH/USDT, and BCH/USDT contracts support both cross and isolated margin mode, their insurance funds (USDT) are shared by these contracts.
When a user's position is liquidated, the system will take over the user's position and close the position in the market. The profit generated by closing the position will be injected into the insurance funds of the corresponding contract. The system will transfer assets to the risk-controlling account during initial transactions or under special circumstances for increasing insurance funds.
A small percentage of fees may be charged when the system takes over users’ positions and implements the liquidation.
Functions of insurance funds: In each period of settlement, if a forced liquidation order fails to close and causes over losses, the system will use insurance funds to compensate users first, and the part that the insurance funds unable to compensate will enter into the clawback mechanism.
Clawback Mechanism
In a fluctuating market, users’ positions may be liquidated. When the order cannot be filled at the takeover price, resulting in huge losses that are greater than the part insurance funds can undertake, the platform will implement the “clawback” mechanism. Each profitable account in the current period compensates the over loss of liquidation according to its profit ratio.
- Contracts that only support isolated margin mode
Consolidate the loss from all forced liquidation orders of a contract, and proceed clawback by using the earnings from profitable accounts of the contract as the clawback base.
Clawback Coefficient = Over Loss from Liquidation / Total Earnings from All Profitable Accounts
Assume at the settlement at 8:00 (UTC), the total loss of the liquidation orders of BTC/USDT swaps is 12,000USDT.
Firstly, the losses will be compensated by the insurance funds. If there are 2,000 USDT of losses remaining, the 2,000 USDT will be compensated by the profitable accounts of BTC/USDT swaps.
Assume all the earnings of profitable accounts is 4,000,000 USDT, then the clawback coefficient is 2,000 / 4,000,000 = 1 / 2,000.
Assume Tom has earned 2,000 USDT from BTC/USDT swaps, then he needs to undertake 2,000 * (1 / 2,000) = 1 USDT
- Contracts that support cross margin mode
Consolidate the over losses from all forced liquidation orders of all contracts that support both cross and isolated margin mode, and proceed clawback by using all the earnings from profitable cross and isolated margin accounts of all contracts that support cross margin mode as the clawback base.
Clawback Coefficient = Over Loss from Liquidation/ Total Earnings from Profitable Cross and Isolated Margin Accounts of All Contracts that Support the Cross Margin Mode
For example, BTC/USDT, ETH/USDT and LTC/USDT swaps support both cross and isolated margin modes. Then the cross and isolated margin accounts of these three swaps share the same insurance funds. Assume it occurs clawback for BTC/USDT swaps, all profitable users of BTC/USDT, ETH/USDT and LTC/USDT swaps in the current period shall join the clawback.
HTX Futures reserves the right in its sole discretion to modify, revise or cancel the announcement at any time and for any reasons without prior notice.