Margin and profit/loss calculations

Open position 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

Coin-margined nominal value = quantity * contract size / order price

Opening loss: Coin-margined opening loss = quantity * contract size * abs {min[0, order direction * (1/order price - 1/mark price)]}

Order direction: 1 represents a long order; -1 represents a short order

Example:

Coin-margined contract. The price is 60000. Open long 12000 BTCUSD contracts. The contract size is 10 USD, 10X. The mark price now is 55000.

Initial Margin = 12000*10/60000/10 = 0.2 BTC

Opening loss = 12000*10 * abs(min(1*(1/60000-1/55000),0)) = 0.181819 BTC

Opening margin = 0.2+0.181819 = 0.381819 BTC

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 BTCUSD long position 1000, opening price of 5000 USD. An hour later, Trader A decides to open additional 2000 positions at 6,000 USD. So, here's the formula and calculation steps for the average opening price.

Average open price= contract total quantity / total value of BTC contract

Replace for numbers in the formulas:

Contract total quantity

= 1,000 + 2,000

= 3,000

The total value of the BTC contract

= (1000 / 5000) + (2000 / 6000)

= 0.53333334 BTC

Average opening price

= (3000 / 0.53333334 BTC)

= 5625.00 USD

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 1,000 long position BTCUSD, opening price is 5000 USD. When the latest market price in the order table is shown as 5,500 USD, the unrealized profit and loss is displayed as 0.01819 BTC.

Unrealized profit/loss= Contract quantity x [(1/average open price) - (1/latest market price)]

= 1000 x [ (1 / 5000) - (1 / 5500)]

= 1,000 x 0.00001819 BTC

= 0.01819 BTC

For short positions

Example:

Trader C now holds 1,000 BTCUSD short positions, opening price is 5000 USD. When the latest market price in the order table is shown as 4,500 USD, the unrealized profit and loss is displayed as 0.02223 BTC.

Unrealized profit/loss= Contract quantity x [(1/latest market price) - (1/average open price)]

= 1000 x [ (1 / 4500) - (1 / 5000)]

= 1,000 x 0.00002223 BTC

= 0.02223 BTC

Note:

  1. a) Reverse contract, as a currency standard contract, where your profit or loss is liquidated in the traded currency, not in US dollars. The USD here is mainly used as a quotation mechanism just for the convenience of traders.

Last updated