# CoinEx | Determine the Right Margin and Margin Rate to Avoid Forced Liquidation

--

As the crypto industry continues to expand, crypto derivatives have also become increasingly diversified. In particular, perpetual contracts are one of the most mainstream derivatives in the crypto market. For many beginners, the first reaction to contracts is: will my position be liquidated? To avoid forced liquidation, we should first learn how to calculate two key parameters — Margin and Margin Rate.

When trading perpetual contracts, the market will charge a small amount of money (subject to your Open Value and Leverage) according to a certain ratio as the security deposit for contract performance. You can only start trading contracts after paying the deposit, which is what we normally call Margin. Given that linear futures contracts and inverse futures contracts are calculated differently, we will focus on the former and illustrate how the Margin and the Margin Rate are calculated.

The act of opening a contract order is called starting a position, which requires an Initial Margin. Initial Margin = Open Value * Initial Margin Rate; Initial Margin Rate = 1 / Leverage * 100%

For example, suppose you want to start a long position when the BTC price stands at 30,000 USDT, the Position Amount would be 1 BTC.

In the above example, Open Value = Position Amount * Open Strike Price = 1*30,000=30,000 USDT;

Initial Margin Rate = 1 / Leverage * 100%=1/10*100%=10%

Initial Margin = Open Value * Initial Margin Rate=30,000*10%=3,000 USDT.

As such, before opening the order, you need to pay an Initial Margin of 3,000 USDT.

After starting a position, the Position Value and Position Margin will also change due to price fluctuations. During this process, the Margin Rate and Maintenance Margin Rate should be your top concern. When the Margin Rate is no higher than the Maintenance Margin Rate required for the current position and the Liquidation Fee, forced liquidation will be triggered.

There are two types of Margin on CoinEx: Isolated Margin and Cross Margin. Under the Cross Margin mode, the full amount of funds in the Available Balance will be used as the Margin on your position. When the Position Margin is less than the Maintenance Margin, any Available Balance will be used to add Margin to your position. Under the Isolated Margin mode, the Initial Margin will be utilized for the current position only. Moreover, it is the holder but not the engine who must add the Margin.

Therefore, when Isolated Margin is selected, Margin Rate = (Position Margin)/Open Value; when Cross Margin is selected, Margin Rate = (Available Margin + Position Margin)/Open Value. In particular, Position Margin = Initial Margin + Increased Margin — Decreased Margin + Unrealized PNL.

(Longs) Unrealized PNL = Position Amount * (Mark Price — Avg. Open Price)

(Shorts) Unrealized PNL = Position Amount * (Avg. Open Price — Mark Price)

In the above example, you started a long position of 1 BTC at the unit price of 30,000 USDT. You then deposited an Initial Margin of 3,000 USDT, with an Available Margin of 2,000 USDT in the account. At this point, the BTC price fell by 5%, and the Mark Price now stands at 28,500 USDT. In the meantime, no Margin was manually added. For the convenience of calculation, transaction fees will not be included in the calculations below.

At this point, the Unrealized PNL = Position Amount * (Mark Price — Avg. Open Price) = 1*(28,500–30,000) = -1,500 USDT;

The Position Margin = Initial Margin + Increased Margin — Decreased Margin + Unrealized PNL = 3,000–1,500 = 1,500 USDT;

Under the Isolated Margin mode, Margin Rate = (Position Margin)/Open Value = 1,500/30,000 = 5%;

Under the Cross Margin mode, Margin Rate = (Available Margin + Position Margin)/Open Value = (1,500+2,000)/30,000=11.67%.

According to the official CoinEx website, the Maintenance Margin Rate is 0.50% when the position level falls between 0–10 BTC, which indicates a Margin Rate of 0.50%. Therefore, the system will liquidate the position. We can then calculate the Liquidation Price in the above case.

Maintenance Margin = Open Value * Maintenance Margin Rate = 30,000*0.50% = 150 USDT

Under the Isolated Margin mode, the Unrealized PNL = Maintenance Margin — Initial Margin = 150–3,000 = -2,850; the Liquidation Price = Unrealized PNL/Position Amount + Avg. Open Price = 27,150;

Under the Cross Margin mode, the Unrealized PNL = Maintenance Margin — Initial Margin — Available Margin = -4,850; the Liquidation Price = Unrealized PNL/Position Amount + Avg. Open Price = 25,150

Through the above example, we can tell that the amount of Margin is closely bound up with the Liquidation Price. To mitigate liquidation risks under extreme market conditions, you must calculate the Margin Rate and adjust your investment strategy in time. Of course, we can also use the Calculator function on CoinEx to determine our returns and the Liquidation Price at any moment with greater convenience.