How To BitMEX: Calculate Liquidation Price on XBTUSD

John Dummett
3 min readFeb 24, 2020

--

New to BitMEX? Sign up with my link for 10% off trading fees: https://www.bitmex.com/register/bUQWwU

In this guide, I will show you how to calculate the liquidation price on your XBTUSD position. This is useful for planning your trades and understanding the purpose of the liquidation price.

What is meant by the terms margin and liquidation?

When trading on leverage, you can open a position with a larger value than the amount of bitcoin you stand to lose, this bitcoin you stand to lose is called initial margin. If the price moves against your position (ie, down when you are long), unrealised losses will be deducted from your initial margin. BitMEX requires that you have a minimum amount of margin remaining on your position, this is called your maintenance margin requirement.

When unrealised losses have reduced your initial margin to the point that only the maintenance margin remains, your position is liquidated. This means that BitMEX takes over your position and you lose all the initial margin you assigned to the position. You should avoid liquidation if possible.

What is the liquidation price? How is it calculated?

The liquidation price is the price at which deductions due to unrealised losses will leave only the maintenance margin remaining on your position and therefore the position will enter liquidation.

There are 4 steps to calculating the liquidation price on an XBTUSD position:
1) Calculate the position bankruptcy price
2) Calculate the position bankruptcy value
3) Calculate the maintenance margin value in XBT
4) Calculate the position liquidation price

Take the following scenario:
Entry price of position = $10,000
Size = Buy 200,000 contracts
Entry Value = 20XBT
Position leverage setting = 20x
Initial Margin = 1XBT
Funding Rate = 0.01%

1) Calculate the position bankruptcy price
To do this, we use the PNL equation from the series guide to determine the price at which the initial margin of the position has been lost.
Size * (1/Entry Price - 1/Bankruptcy Price) = Initial Margin * -1
200000 * (1/10000 - 1/Bankruptcy Price) = 1 * -1
Bankruptcy Price = 9523

2) Calculate the position bankruptcy value
To do this, we simply calculate the position value at the bankruptcy price.
Bankruptcy Value = Size * (1/Bankruptcy Price)
Bankruptcy Value = 200000 * (1/9523)
Bankruptcy Value = 200000 * 0.00010501
Bankruptcy Value = 21.002XBT

3) Calculate the maintenance margin value in XBT
The maintenance margin requirement can be found in the contract specification.
Maintenance Margin = 0.50% + Exit Taker Fee + Funding Rate
What does that mean in practice?
MM = (0.5% * Entry Value) + (0.075% * Bankruptcy Value) + (0.01% * Bankruptcy Value)
MM = (0.5% * 20) + (0.075% * 21.002) + (0.01% * 21.002)
MM = 0.1178517XBT

4) Calculate the position liquidation price
To do this, we use the PNL equation from the series guide to determine the price at which only the maintenance margin remains on the position (ie, the rest of the initial margin has been deducted due to unrealised losses.)
(Size * (1/Entry Price - 1/Liquidation Price)) = (Initial Margin - MM) * -1
(200000 * (1/10000 - 1/Liquidation Price)) = (1 - 0.1178517) * -1
Liquidation Price = $9577.56

💪

How can I check my calculation?

You can check your calculation by using the BitMEX calculator tool, the calculator tool is located on the trade dashboard. For example:

When using the calculator, make sure you are on the right contract and that your example does not include Gross Open Premium (for example, if your buy price is above the current mark price, the initial margin requirement will be more than the standard (Entry Value * 1/Leverage) and the result in the calculator will not line up with your calculation.

This is an entry in the “How To BitMEX” series, where I impart unique knowledge to traders looking to become better users of BitMEX. To ensure you don’t miss out on new publications, please follow me on Twitter.

New to BitMEX? Sign up with my link for 10% off trading fees: https://www.bitmex.com/register/bUQWwU

--

--

John Dummett

Trading crypto since 2013. Ex-BitMEX, joined in 2017 as one of the first employees, left in 2020. Now writing about crypto trading.