Margin and profit/loss calculations
Opening margin
The opening margin includes the initial margin and the opening loss.
Opening losses occur when the futures contract price moves unfavourably (that is, the mark price is lower than the order price of the long order). Incorporating opening losses into the cost of opening a position can help prevent forced liquidation when traders place orders. If the opening loss is not included in the cost of opening a position, users’ positions are likely to be liquidated immediately when they place an order.
Initial Margin = Notional Value / Leverage
U-margined nominal value = order price * quantity * contract size
Opening loss: U-margined opening loss = quantity * contract size * abs {min[0, order direction * (mark price - order price)]}
Order direction: 1 represents a long order; -1 represents a short order
Example:
U-margined contract. The price is 60000. Open long 10000 BTCUSDT contracts. The contract size is 0.0001BTC, 10X. The mark price now is 55000.
Initial Margin = 60000*10000*0.0001/10 = 6000
Opening loss = 10000*0.0001*5000 = 5000
Opening margin = 6000+5000 = 11000
Average opening price
When an open position occurs, the average price of the open position is recalculated.
Example: Trader A now holds multiple positions of BTCUSDT long position 0.5, opening price of 5000 USD. An hour later, Trader A decides to open an additional 0.3 position at 6,000 USD.
Below are the formulas and calculation steps for the average opening average price:
-Average open price = USDT total contract value/total contract quantity
-Total contract value in USDT= [ (contract quantity 1 * price 1) + (contract quantity 2 * price 2)...]
We obtain the following data:
The total value of the contract in USDT
=[(Contract quantity 1 x price 1) + ( contract quantity 2 x price 2)]
= [ (0.5 x 5000) + (0.3 x 6000) ]
= 4300
Contract total quantity
= 0.5 + 0.3
= 0.8 BTC
Average opening price
= 4300 / 0.8
= 5375
Profit/loss
After opening a position, the position and its profit and loss can be seen in real time in the position area.
Depending on the direction of your trade, the formula for calculating profit and loss is slightly different.
For multiple positions
Example:
Trader B now holds multiple positions of BTCUSDT long position 0.2, opening price of 7000 USDT. When the latest market price in the order table is shown as 7,500 USD, the unresolved profit and loss is displayed as 100 USDT.
Profit/loss= Contract quantity x (marked price - average opening price)
= 0.2 x (7500 - 7000)
= 100 USDT
For short positions
Example:
Trader C now holds a short position of BTCUSDT short position 0.4, opening price of 6000 USD. When the latest market price in the order table is shown as 5,000 USD, the unresolved profit and loss is displayed as 400 USDT.
Profit/loss= Contract quantity x (average opening price - marked price)
= 0.4 x (6000 - 5000)
= 400 USDT
Last updated