Margin of Coin-margined Futures

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

**What is margin?**

Contracts margin is a good-faith deposit, or an amount of capital one needs to post or deposit to control a futures contract.

**Cross-margin mode is available in HTX Futures**, the position margin required varies with the price movements.

Position margin = (contract face value * quantities of contracts) / latest price / leverage ratio

E.g.1 : If the user opens long 10 lots of BTC contracts (with contract face value of 100 USD/lot), the latest price is 5000 USD/BTC and leverage ratio is 10x, then,

Position Margin = (100*10)/5000/10=0.02BTC

E.g.2 : If the user opens long 10 lots of EOS contracts (with contract face value of 10 USD/lot), the latest price is 5 USD/EOS and leverage ratio is 10x, then,

Position Margin =（10*10）/5/10=2 EOS

**Differentiate Margin System**

In order to maintain the stability of the contract market and reduce the risk of large positions, HTX Futures uses a differential margin system. When the user chooses 20x or more than 20x leverage, and the user's account equity exceeds a certain range, the available margin will change. Choosing 10x and lower leverage will not be influenced by differential margin system. Details are showed as follow:

Unit: underlying asset

* As a example for BTC

**[searching trading limit 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.]

For example, if the user's account equity is 80BTC,choosing 20x leverage, the available margin shall be 50 BTC. Therefore，the maximumamount of BTC that the user can use to open positions is 50.

Note: For maximum scale of Differentiate Margin System,

Available Coefficient = 1 / Corresponding leverage

**Locked Margin Optimization Scheme**

To improve asset utilization and to reduce position margin for users, HTX Futures implements locked margin optimization scheme when users have the same type or several types futures with long and short positions for the same coin.

When users have the same type or several types futures with long and short positions for the same coin, Locked margin optimization scheme could reduce part of users’ position margin.

Locked margin = Total long and short position margin - Total locked margin of the same type futures *Optimization ratio for the same type futures – Total locked margin of all types futures* Optimization ratio for all types futures

- Total long and short position margin is the sum of 8 positions margin. The formula is as below:

Total long and short position margin = The sum of long position margin of all types futures + The sum of short position margin of all types futures

Among which, Position margin = (Contract face value * contract quantity) / latest price / leverage

- The locked margin of the same type futures takes the minimum value from long position margin of the same type futures and short position margin of the same type futures. Therefore, the total locked margin of the same type futures is the sum of minimum values of locked margin of all types futures. The formula is as below:

Total locked margin of the same type futures = min (Long position margin of weekly futures, Short position margin of weekly futures) + min (Long position margin of bi-weekly futures, Short position margin of bi-weekly futures) + min (Long position margin of quarterly futures, Short position margin of quarterly futures) + min (Long position margin of bi-quarterly futures, Short position margin of bi-quarterly futures)

- Total locked margin takes the minimum value from total long position margin of all types futures and total short position of all types futures. Total locked margin of all types futures can be gotten by using total locked margin minus total locked margin of the same type futures. The formula is as below:

Total locked margin of all types futures = Total locked margin - Total locked margin of the same type futures

Among which, Total locked margin = min (The sum of long position margin of all types futures, The sum of short position of all types futures)

- The optimization ratio for locked margin of the same type futures is 100% and the optimization ratio for locked margin of all types futures is 50%.

Example 1: Same type futures with long and short positions for one coin

Tom holds long positions of 1000 conts and short positions of 800 conts BTC Quarterly futures contracts with 20x leverages. The BTC futures contract face value is 100 USD and the latest price of BTC Quarterly futures contract is 9500 USD. We can calculate Tom’s locked margin through following steps:

- First calculate Tom’s total long and short position margin. Because Tom only has quarterly futures contracts, the total long and short position margin=0.5263 + 0.4210 = 0.9473 BTC;
- Then calculate Tom’s total locked margin of the same type futures. Because Tom only holds one futures contract type which is quarterly futures contract, the locked margin of this same type futures equals to the total locked margin of the same type futures, which is min (0.5263, 0.4210) = 0.4210 BTC;
- Because Tom doesn’t have other types futures except for quarterly contracts, and according to the formula: Locked margin = Total long and short position margin - Total locked margin of the same type futures *Optimization ratio for the same type futures – Total locked margin of all types futures* Optimization ratio for all types futures; the optimization ratio for locked margin of the same type futures is 100% and the optimization ratio for locked margin of all types futures is 50%; we can calculate Tom’s locked margin= 0.9473 －0.4210 * 100% －0 * 50% = 0.5263 BTC.
- So actual positon margin for his position is 0.9473 BTC. After using locked position function, his bidirectional position margin takes only 0.5263 BTC.

Example 2: Several types futures with long and short positions for one coin

Tom has long and short positions of all the four types BTC contracts with 10x leverages, and the BTC contract face value is 100 USD. Now we can calculate Tom’s locked margin through following steps:

- Calculate Tom’s total long and short position margin.

- According to the formula: Total long and short position margin = The sum of long position margin of all types futures + The sum of short position margin of all types futures;
- Total long position margin of all types futures = 1.8108 + 1.2060 + 1.5018 + 3.0000 = 7.5186 BTC;
- Total short position margin of all types futures = 1.0060 + 0.8040 + 2.0024 + 2.5000 = 6.3124 BTC;
- Therefore, Total long and short position margin = 7.5186 + 6.3124 = 13.8310 BTC.

- Calculate Tom’s total locked margin of the same type futures.

- According to the formula: Total locked margin of the same type futures = min (Long position margin of weekly futures, Short position margin of weekly futures) + min (Long position margin of bi-weekly futures, Short position margin of bi-weekly futures) + min (Long position margin of quarterly futures, Short position margin of quarterly futures) + min (Long position margin of bi-quarterly futures, Short position margin of bi-quarterly futures)
- Therefore, Tom’s total locked margin of the same type futures = min (1.8108, 1.0060) + min (1.2060, 0.8040) + min (1.5018 + 2.0024) + min (3.0000, 2.5000) = 5.8118 BTC;

- Calculate Tom’s total locked margin of all types futures.

- To calculate Tom’s total locked margin of all types futures, we have to know his total locked margin first. According to the formula, total locked margin = min (The sum of long position margin of all types futures, The sum of short position of all types futures)
- Since we already know his total long position margin of all types futures is 7.5186 BTC and total short position margin of all types futures is 6.3124BTC from the first step, we can calculate Tom’s total locked margin = min (7.5186, 6.3124) = 6.3124 BTC;
- From second step we know Tom’s total locked margin of the same type futures is 5.8118 BTC, and the formula: Total locked margin of all types futures = Total locked margin - Total locked margin of the same type futures, now we can get Tom’s Total locked margin of all types futures = 6.3124－5.8118 = 0.5006 BTC;

- Calculate Tom’s locked margin.

- According to the formula: Locked margin = Total long and short position margin- Total locked margin of the same type futures *Optimization ratio for the same type futures – Total locked margin of all types futures* Optimization ratio for all types futures
- The optimization ratio for locked margin of the same type futures is 100% and the optimization ratio for locked margin of all types futures is 50%.
- Now we can get Tom’s locked margin = 13.8310－5.8118 * 100%－0.5006 * 50% = 7.7689 BTC.
- So actual positon margin for his position is 13.8310 BTC. After using locked position function, his multi-period position margin takes only 7.7689 BTC.

**Calculation of Available Asset for Transfer**

**Available asset for transfer = max {0, Current-period initial equity + Current-period transfer_in quantity - Current-period transfer_out quantity + min (Realized PnL, 0) +min (Unrealized PnL, 0) - max [ 0, f(Occupied) - max (0, Realized PnL)]} + max {0, [Realized PnL - f (Occupied)]} * Available coefficient of realized PnL.**

Note: The available coefficient of assets settled periodically is 0, and the available coefficient of assets settled in real-time is 1.

Example 1: Assume Tom’s initial equity in BTC contracts account was 1BTC, and bought 100 conts quarterly of a long position with leverage 5X and open price of 10,000USD. When the latest price rises to 12,000USD, the available asset for transfer are calculated as below (transaction fees will be negligible):

Unrealized PnL = (1 / 10,000 - 1 / 12,000) * 100 * 100 = 0.1667 BTC;

f(Occupied) =Occupied margin= (100 * 100) / 12,000 / 5 = 0.1667 BTC;

Available asset for transfer = max [0, 1+0-0+0+0-0.1667] + 0 = 0.8333 BTC.

Example 2: Assume Tom’s initial equity in BTC contracts account was 5BTC, and bought 10,000 conts quarterly of a long position with leverage 100X and open price of 10,000USD. When the latest price reached 12,000USD, he closed 5,000 conts. Then the price declines to 9,000USD, at this time, the available asset for transfer are calculated as below (transaction fees will be negligible):

Unrealized PnL = (1 / 10,000 - 1 / 9,000) * 5,000 * 100 = -5.5556 BTC;

Realized PnL = (1 / 10,000 - 1 / 12,000) * 5,000 * 100 = 8.3333 BTC;

Occupied margin = (5,000 * 100）/ 9,000 / 100 = 0.5556 BTC;

However, when using the leverage 100X, the available margin is limited by the tiered margin and the corresponding available coefficient turns to be 50.00%, then the actual f(Occupied) needs to be calculated as below:

f(Occupied) = 0.2 + ( 0.5556 - 0.2 ) / 50.00% = 0.9112 BTC;

Available asset for transfer = max [0, 5+0-0+0-5.5556-0] + [8.3333 - 0.9112] = 6.8665 BTC .

In conclusion, when the account equity exceeded a certain range and larger leverage used, the available margin will be restricted by the tiered margin. Then the occupied margin actually required becomes more, and the available asset for transfer becomes relatively less.

**Margin Ratio**

Margin Ratio is an indicator used to assess assets risk.

Margin Ratio = (Account Equity / Used Margin) * 100% - Margin call coefficient

The lower of margin ratio, the higher risk of the account will be. When the margin ratio is ≤0%, liquidation will be triggered.