# Partial Liquidation of Futures

- Hướng dẫn Coin-M Kỳ hạn

**What is liquidation？**

Margin ratio is an indicator used to weigh the users’ assets risk. When margin ratio is less than or equal to 0%, liquidation will be triggered.

**Margin Ratio = (Equity Balance / Occupied Margin ) * 100% – Adjustment Factor**

**Note: Occupied Margin = Position Margin + Frozen Margin**

HTX Futures implement the partial liquidation, that is, the system will try to reduce the tier corresponding to the adjustment factors, so as to avoid all positions being liquidated at one time.

If the liquidation is trigged when the corresponding adjustment factor belongs to Tier 1:

- The system will cancel all open orders for this contract;
- The long and short positions of the contract in the same period will be self-traded;
- If the margin ratio of the user's position is still less than 0 at this time, it will be liquidated at once.

If the liquidation is trigged when the corresponding adjustment factor is more than Tier 1:

- The system will cancel all open orders for this contract;
- The long and short positions of the contract in the same period will be self-traded；
- If the margin ratio is still less than 0, the system will reduce his net positions to the upper limit of a certain tier, so as to decrease the adjustment factor and make the margin ratio greater than 0.
- If the margin ratio 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, users cannot proceed any operation related to this contract.

**What’s adjustment factor?**

The adjustment factor is designed to prevent users from extended margin call loss. HTX Coin-margined futures uses a tiered adjustment factor mechanism, which supports up to five tiers based on the position amount (cont). The larger the user’s net positions, the higher the tier and the greater the risk.

Take BTC as an example. Assume Tom’s net position is 1,000 conts, belonging to the Tier 2. The adjustment factor for 10x leverage, 20x leverage, and 5x leverage is 10%, 20%, and 5%, respectively.

Please Note: The face value of a BTC contract is 100 USD/cont, and that of other asset is 10 USD/cont.

**[****searching adjustment factor of more trading pairs****]**

[The above data and indicator contents may be adjusted in real time according to market conditions, and the adjustments will be made without further notice.]

**What is estimated liquidation price?**

The estimated liquidation price is an estimated market price when the margin ratio is equal to or less than 0%. Please note that this price is for reference only. The real-time liquidation price should refer to the last transaction price when the margin ratio reaches to 0%.

**What’s mark price?**

To reduce unnecessary liquidations, Coin-margined futures uses mark price as another reference price for liquidation. That is, when the system determines whether to trigger a liquidation, it must satisfy that the margin ratios calculated both by using the last price and by using mark price are less than or equal to 0%. Using mark price for calculation can avoid the risk of liquidation or serial liquidation caused by several abnormal prices as much as possible.

**Mark price calculation**

Basis fair price of bid and ask middle price is a relatively reasonable reference price for coin-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 last 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 the 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 conts based on the open orders on current order book. The depth weighted bid price = the average bid price of N conts;
- The depth weighted ask price refers to the average ask price when the cumulative amount of open orders from ask_one reaches N conts based on the open orders on current order book. The depth weighted ask price = the average ask price of N conts.

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 coin-margined futures.

**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 = 10000；P2 = 10006；P3 = 10011；then，

(1) EMA1 = P1 = 10000；

(2) EMA2 = ( P2 – EMA1 ) * Factor + EMA1 = ( 10006 – 10000 ) * 1 / 3 + 10000 = 10002；

(3) EMA3 = ( P3 – EMA2 ) * Factor + EMA2 = ( 10011 – 10002 ) * 1 / 3 + 10002 = 10005；

……

The above EMA will be calculated every 5 seconds separately for various types of futures with different expirations, and the formulas are as below:

**Mark Price = Median (Bid and Ask Middle Price Basis Fair Price****，Depth Weighted Fair Price，Latest EMA)**

To avoid unnecessary liquidations caused by abnormal mark price, when mark price sharply deviates from the contract price, the system will adjust the mark price accordingly; 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))**

Currently, only a few contracts calculate the mark price by using the median, while the others adopt “Mark Price = Latest EMA” to calculate. Details are as follows:

[ The above data and indicator contents may be adjusted in real time according to market conditions, and the adjustments will be made without further notice. ]

**What is takeover price?**

Liquidation will be triggered when the last price reaches the liquidation price. The system will take over users’ positions at the takeover price (a price when a 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. For liquidation order details, you can click [ ? ] on HTX APP or click “Details” under the “Order History”.

**Example on APP:**

**Example on web page:**

**Details of ****L****iquidat****ion**** ****O****rders:**

**For example,**

Assume Tom has 20 BTC in his account equity. He opened a long position of 15,000-conts of BTC quarterly contract at the price of 8,000USD (face value=100USD/cont). The leverage is 10x, and the adjustment factor is 14%, belonging to Tier 3. Without considering any transaction fees, what will happen to his positions when the last price reaches 7,330.12 USD?

Let’s calculate by the next steps:

**1. Unrealized PnL**

- Since Tom opened a long position, we use the formula for long positions:, Unrealized PnL (Long) = (1 / Position Price – 1 / Last Price) * Position Amount (cont) * Contract Face Value
- Therefore, the Unrealized P/L = (1 / 8,000 – 1 / 7,330.12) * 15,000 * 100 = –17.1351BTC
- When the last price reaches 7,330.12 USD, Tom’s unrealized PnL is –17.1351BTC.

**2. Account Equity**

- According to the formula: Account Equity = Account Balance + Current-period Realized PnL + Current-period Unrealized PnL
- Therefore, Tom’s account equity = 20 + 0 + ( – 17.1351 ) = 2.8649BTC
- When the last price of BTC quarterly contract reaches 7,330.12 USD, his account equity is 2.8649BTC.

**3.Position Margin**

- According to the formula: Position Margin = (Contract Face Value * Position Amount (cont) / Last Price / Leverage
- Therefore, Tom’s position Margin = ( 100 * 15,000 ) / 7,330.12 / 10 = 20.4635BTC
- When the last price of BTC quarterly contract reaches 7,330.12, his current position margin is 20.4635BTC.

**4. Is liquidation triggered？**

- According to the formula: Margin Ratio = (Account Equity / Occupied Margin) * 100% – Adjustment Factor
- His margin ratio = (2.8649 / 20.4635) * 100% – 14% = 0%
- At this time, the EMA price the system calculated is 7,330.10 according the EMA formula
- As mentioned above, when the margin ratios calculated by using both the last price and the EMA are equal to or less than 0, his positions will be liquidated
- In conclusion, his positions will be liquidated when the last price reaches 7,330.12 USD.

**5.What will happen after liquidation？**

- After the liquidation is triggered, the system detects that Tom's net position is 15,000 conts and the corresponding adjustment factor belongs to Tier 3. Then the system will try to recalculate his margin ratio using the maximum position of the Tier 2 (9,999 conts) as the remaining position amount and by using the adjustment factor of Tier 2 (10%);
- Position Margin = (100 * 9,999) / 7,330.12 / 10 = 13.6409 BTC
- Realized PnL of positions that has been taken over = (1 / 8,000 – 1 / 7,228.91) * （15,000 – 9,999）* 100 = –6.6680BTC
- Unrealized PnL of positions that has not been taken over = (1 / 8,000 – 1 / 7,330.12) * 9,999 * 100 = –11.4222BTC
- Account equity = 20 + (– 6.6680 ） + ( – 11.4222 ) = 1.9098 BTC
- Therefore, if Tom only holds 9,999 conts, the Margin Ratio of his position = ( 1.9098 / 13.6409 ) * 100% – 10% ＞ 0%
- At this time, the system will take over 5001 conts (15000 – 9999) with the takeover price, the part that exceed the position amount of Tier 2, it means that Tom’s position will be partially liquidated.

**6. How about the takeover price？**

- Takeover price is a price when the account equity is 0. Assume the takeover price is x, (1 / 8,000 – 1 / x) * 15,000 * 100 = –20 BTC, then x = 7,228.91 USD.
- Therefore, the price that makes the account equity equals 0 is 7,228.91 USD. At the same time, this price is also a price used by the system to take over Tom's long position of 5001 conts of BTC quarterly contracts, and it will not be displayed on the K-line;
- After the partial liquidation is completed, the remaining position is 9,999 conts, and all trading will be resumed.

（The above is for clarification purposes, and the specific adjustments shall be subject to the announcement.）

**Insurance funds**

Insurance funds are designed to cover the over losses from liquidation.

There is a separate insurance fund for each trading pair, and a contract with different expirations share a mutual insurance fund. For example, BTC weekly, bi-weekly, quarterly and bi-quarterly contracts share a mutual insurance fund.

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 fund 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.

Usage of insurance funds: In each period of settlement/delivery, if a liquidation order fails to close and causes over losses, the system will use insurance fund to compensate users first, and the part that the insurance fund unable to compensate will enter into the clawback mechanism.

**Clawback Mechanism**

When the market fluctuates severely, users’ positions might be liquidated. When the order cannot be filled at the liquidation price, huge losses incur that are greater than the part insurance fund can undertake. The platform adopts the “clawback” mechanism. Each profitable account in the current period compensates the over loss of liquidation according to its profit ratio.

**Full account clawback system**

Coin-margined futures implements a "full account clawback" mechanism. The system sums up all the losses from all liquidation orders of a contract, and proceed clawback by using the earning from all profitable accounts of the contract (including Weekly, Bi-weekly, Quarterly and Bi-quarterly futures) as the clawback base.

Clawback Coefficient = Over Losses from Liquidation / Total Earning from All Profitable Accounts

Assume at the settlement/delivery on Friday, the total losses = Weekly losses + Bi-weekly losses + Quarterly losses + Bi-quarterly losses= 0BTC – 100BTC – 20BTC = – 120BTC

Firstly, the losses will be compensated by the insurance fund. If there are 20 BTC of losses remaining, the 20 BTC will be compensated by the profitable accounts of BTC coin-margined futures.

Assume all the earnings of profitable accounts is 400,000 BTC, then the clawback coefficient is 20 / 400,000 = 1 / 20,000.

Assume Tom has earned 2 BTC from BTC coin-margined futures, then he needs to undertake 2 * (1 / 20,000) = 0.0001 BTC.

*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.*