Understanding how profit and loss are calculated before opening a position is very important for any type of trading. Below, we will go through the steps to help traders accurately understand how the following variables affect profit and loss calculations.
1. Average Opening Price
In XXKK's USDT-M, no matter when a trader increases their position, the average opening price will change.
Example: User A currently holds a long position in BTCUSDT with 0.1 BTC, and the opening price is 40,000 USDT. An hour later, User A decides to open an additional 0.1 BTC position at an opening price of 42,000 USDT.
Average Opening Price = Total Contract Value / Total Contract Quantity
Total Contract Value = [(Contract Quantity 1 x Price 1) + (Contract Quantity 2 x Price 2)] = [(0.1 x 40,000) + (0.1 x 42,000)] = 8,200
Total Contract Quantity = 0.1 + 0.1 = 0.2 BTC
Average Opening Price = 8,200 / 0.2 = 41,000
2. Unrealized PnL
Once an order is filled, the position and its unrealized profit and loss (PnL) can be seen in the position area.
Depending on the trade direction, the formula for calculating unrealized PnL differs slightly.
2.1 For Long Positions
Example: User A holds a 0.2 BTC long position in BTCUSDT with an opening price of 41,000 USDT. When the current mark price shows 43,000 USDT, the unrealized PnL will be 400 USDT.
Unrealized PnL = Contract Quantity x (Current Mark Price − Opening Price) = 0.2 x (43,000 − 41,000) = 400 USDT
2.2 For Short Positions
Example: User A holds a 0.4 BTC short position in BTCUSDT with an opening price of 40,000 USDT. When the current mark price shows 39,000 USDT, the unrealized PnL will be 400 USDT.
Unrealized PnL = Contract Quantity x (Opening Price − Current Mark Price) = 0.4 x (40,000 − 39,000) = 400 USDT
※ In USDT-M, your profit and loss are settled in USDT. This contrasts with inverse contracts (coin-margined), where the settlement is done in the traded coin (e.g., BTC for BTCUSD).
※ Price fluctuations (e.g., 1,000 USDT), whether in an upward or downward direction, mean that if the position size is 1 BTC, the trader will gain or lose 1,000 USDT.
※ Increasing leverage does not directly multiply your profit or loss. Instead, profit and loss are determined by position size and price fluctuations. Simply put, higher leverage reduces the margin required to open a position, but larger position sizes lead to greater profit/loss; the larger the price difference from the opening price, the greater the profit/loss.
※ The unrealized PnL displayed by default is calculated based on the latest market price. When hovering over the displayed number, the unrealized PnL will also be shown based on the mark price.
※ Lastly, it’s important to note that unrealized PnL calculations do not include any transaction fees or funding fees paid or received during opening/closing/holding positions.
3. Unrealized PnL Percentage
The unrealized PnL percentage essentially shows the return on investment (ROI) for the position in percentage terms.
Like unrealized PnL, this number constantly changes with the latest market price. The formula for unrealized PnL percentage is as follows:
Unrealized PnL Percentage(%) = Unrealized PnL / Position Margin x 100%
Position Margin = Starting Margin + Closing Fees
Example: User A holds a 0.2 BTC long position in BTCUSDT with an opening price of 41,000 USDT. When the current market price shows 43,000 USDT, the unrealized PnL will be 400 USDT. Let’s assume the leverage used is 10x.
Based on the previous calculation,
Unrealized PnL = 400 USDT
Starting Margin = (Contract Quantity x Opening Price) / Leverage = (0.2 x 41,000) / 10 = 820 USDT
Closing Fee = Bankruptcy Price x Contract Quantity x 0.06% = 36,877.86 x 0.2 x 0.06% = 4.4253 USDT
Unrealized PnL Percentage(%) = 400 / (820 + 4.4253) x100% = 48.52%
※ Some traders mistakenly believe that increasing leverage increases their unrealized profits.
The percentage rise in unrealized PnL is due to the reduced position margin, not because of actual profits.
For User A, regardless of whether the leverage is 10x, 5x, or 50x, the unrealized PnL remains the same.
If User A uses the original leverage of 10x,
Unrealized PnL = 400 USDT, Unrealized PnL Percentage = 48.52%.
If User A reduces the leverage to 5x,
Unrealized PnL = 400 USDT, Unrealized PnL Percentage = 24.32%.
If User A increases the leverage to 50x,
Unrealized PnL = 400 USDT, Unrealized PnL Percentage = 237.49%.
For cross margin mode, the position margin is calculated based on the highest allowed leverage for the current risk limit of the asset (e.g., BTCUSDT = 125x).
4. Realized PnL
When the trader finally closes the position, the profit or loss is realized, and it can be found in the contract history.
Realized PnL is calculated based on the difference between the entry price and the exit price, taking into account any transaction fees and funding fees that were paid or received during the trade. Once the position is closed, the profit or loss becomes final and is locked in the account history.
| Unrealized PnL Calculation | Realized PnL Calculation | |
| Position PnL | Include | Include |
| Transaction Fees | Not Include | Include |
| Funding Fees | Not Include | Include |
Realized PnL = Position PnL - Opening Fee - Closing Fee - Total Funding Fee Paid / Received
Example: User A currently holds a short position of 0.4 BTC in BTCUSDT with an opening price of 40,000 USDT. When the latest market price in the order book shows 39,000 USDT, the unrealized PnL is 400 USDT. User A decides to close the entire position using a market order when the latest market price is 39,000 USDT. Assume User A also opened the position using a market order and paid a total of 4.2 USDT in funding fees during the holding period.
Based on the previous calculation, the position PnL is 400 USDT (profit).
Opening Fee = Contract Quantity x Opening Price x 0.06% = 9.60 USDT (paid)
Closing Fee = Contract Quantity x Closing Price x 0.06% = 9.36 USDT (paid)
Total Funding Fee Paid / Received = 4.20 USDT (paid)
Realized PnL = 400 - 9.60 - 9.36 - 4.20 = 376.84 USDT
※ The above example applies only when the entire position is opened and closed with a single order. For partial positions, the realized PnL is calculated proportionally for all fees (opening fee and funding fees), and the proportion is reflected in the realized PnL.