# Margin and profit and loss calculation

Open Margin
The margin for opening a position refers to the minimum collateral amount required to open a position in leveraged trading. The leverage used by traders is inversely proportional to the initial margin required to hold a position. The higher the leverage, the less margin is required to open a position.
In the USDT perpetual contract, the opening margin is obtained by multiplying the commission value by the initial margin rate. The initial margin rate depends on the leverage used.
Open Margin = Contract Quantity x Entry Price / Leverage
example:
The trader opens a long order of 1 BTC at 10,000 USDT with 50x leverage.
Initial Margin = (1 x 10,000) / 50 = 200 USDT
Average opening price
When opening a position occurs, the average opening price will be recalculated.
Example: Trader A now holds a long position of BTCUSDT 0.5 with an opening price of 5000 USD. An hour later, Trader A decides to open an additional position of 0.3 at 6,000 USD.
The following is the formula and calculation steps of the average opening price:
1
Average opening price = total contract value in USDT / total contract quantity

Copied!
1
Total contract value in USDT = [(Contract Quantity 1 x Price 1) + (Contract Quantity 2 x Price 2)...]

Copied!
Substitute the above data:
Total contract value in USDT
= [ (Contract Quantity 1 x Price 1) + (Contract Quantity 2 x Price 2) ]
= [ (0.5 x 5000) + (0.3 x 6000) ]
= 4300
Total number of contracts
= 0.5 + 0.3
= 0.8 BTC
average opening price
= 4300 / 0.8
= 5375
Profit and loss
After opening a position, the position and its profit and loss can be seen in real time in the position area.
The formula for calculating profit and loss is slightly different depending on the direction of your trade.
For long positions
Example:
Trader B now holds a long position of BTCUSDT 0.2 with an opening price of 7000 USDT. When the latest market price in the order form is displayed as 7,500 USD, the unrealized profit and loss will be displayed as 100 USDT.
1
Profit and Loss = Contract Quantity x (Mark Price - Average Open Price)

Copied!
= 0.2 x (7500 - 7000)
= 100 USDT
For short positions
Example:
Trader C now holds a short position of BTCUSDT 0.4 with an opening price of 6000 USD. When the latest market price in the order form is displayed as 5,000 USD, the unrealized profit and loss will be displayed as 400 USDT.
1
Profit and Loss = Contract Quantity x (Average Opening Price - Mark Price)

Copied!
= 0.4 x ( 6000 - 5000)
= 400 USDT