Account Equity and PnL Calculation

Account Equity

The account equity of USDT-margined swaps account is the total equity of USDT-margined swaps for a certain asset. The account equity for each asset is calculated independently. The formula is as below:

Account equity of isolated margin account= Account balance + Realized PnL for current period+ Unrealized PnL for current period

Account equity of cross margin account= Account balance + Realized PnL of all swaps for current period+ Unrealized PnL of all swaps for current period

Account Balance

Account balance is the token quantity a user has in his USDT-margined swaps account, including transfer_in and transfer_out quantity. At the settlement, the realized PnL will be added or reduced on this item.

Account Balance = Current-period initial equity + Current-period transfer_in quantity + Current-period transfer_out quantity

Unrealized PnL

Unrealized PnL is the current profit or loss on an open position of USDT-margined swaps. It is a reflection of what profit or loss could be realized and would change with the market price.

Unrealized PnL (long) = (Latest price – Position price) *Quantity of long positions *Contract face value

Unrealized PnL (short) = (Position price – Latest price) *Quantity of short positions *Contract face value

Example: A user holds 100 cont BTC/USDT swaps of long positions (the face value of each contract is 0.001BTC) with the position price 5000 USDT/BTC. Assume the latest price is 8000USDT/BTC, the unrealized PnL is（8000-5000）* 100 * 0.001 = 300 USDT

Realized PnL

Realized PnL refers to the profit or loss on a completed trade, which includes the transaction fees, funding paid or received by the user. Realized PnL cannot be transferred out from USDT-margined swaps account before settlement.

Realized PnL (long) = (Positions closing price – Position price) *Quantity of long positions *Contract face value

Realized PnL (short) = (Position price – Positions closing price) *Quantity of short positions *Contract face value

Example:

Assume Tom holds 100 conts BTC/USDT swaps (0.001BTC/contract) of long positions with the position price 5,000 USDT. If the position-closing price is 4,000 USDT/BTC, the realized PnL of this long position is (4,000-5,000) * 100 * 0.001= -100 USDT; The transaction fee for closing this position (taker fee rate: 0.04%) = 100 * 0.001 * 5,000 * 0.04% = 0.2 USDT; At this time, the closing PnL and the transaction fee will be merged as -100.2 USDT and calculated into the realized PnL.

Open Price

Open price is the average cost price of opening positions and the actual cost of opening positions. It will not change along with the settlement. Positions of the same assets under the same mode and the same direction will be calculated jointly.

Assume Tom buys/sells 100 conts BTC/USDT swaps at the price of 10,000 USDT and buys/sells another 200 conts at the price of 11,000 USDT, then the open price of this position= (100 * 10,000 + 200 * 11,000) / (100 + 200) = 10,666.66 USDT.

Position Price

Position price is a price used to calculate users’ unrealized PnL and the closing PnL. The price will be adjusted accordingly after each settlement or position increase, while the change of position price will not affect the user’s actual PnL. When closing a position, the cost will be calculated by using the moving average method. That is to say, the system will not distinguish the position at which open price is to be closed, instead it will use the average position price as the cost price to calculate PnL.

For example: Tom bought 100 conts BTC/USDT swaps of long positions at 8:30 am (GMT+8) at the price of 10,000 USDT, and bought another 200 conts at the price of 11,000 USDT at 12:30 pm (GMT+8), then the open price = position price = (100 * 10,000 + 200 * 11,000) / (100 + 200) = 10,666.66 USDT.

1. Before the settlement, the open price of the user’s position is equal to the position price 10,666.66 USDT. Assume the settlement price at 16:00 (GMT+8) is 12,000 USDT, the system will calculate the realized PnL by using the settlement price and transfer them to the account balance. Meanwhile, the position price will be adjusted to 12,000 USDT after the settlement, while the open price keeps unchanged, which is at 10,666.66 USDT.
2. After the settlement, assume Tom increases another 200 conts of long positions at the price of 12,800 USDT at 18:00 (GMT+8), then the open price and position price of the position are as below:
3. a) Open price = (300 * 10,666.66 + 200 * 12,800) / (300 + 200) = 11,519.99 USDT;
4. b) Position price = (300 * 12,000 + 200 * 12,800) / (300 + 200) = 12,320.00 USDT;
5. If the user closes part of this position, both the open price and the position price will not change.

PnL and PnL Ratio

PnL (Positions) refers to the profits and losses for current unclosed positions, including the realized PnL from previous settlements and the unrealized PnL from the last settlement.

PnL ratio refers to the percentage of the PnL from holding the position to the cost of opening the position, that is, PnL ratio = PnL / Initial Margin.

For instance, Tom bought 100 conts BTC/USDT swaps with 10x leverage to open a long position at the price of 10,000 USDT and the order is completely filled. When the latest price rises to 11,500 USDT, the PnL and PnL Ratio are calculated as below:
PnL (Positions)= (11,500 – 10,000) * 100 * 0.001 = 150 USDT;
PnL ratio = 150 / (0.001 * 100 * 10,000 / 10) = 150%.

Closing PnL and PnL

Closing PnL represents the PnL from the latest settlement, excluding the PnL from previous settlements. If any settlement has been proceeded for your position, the system will use the average position-closing price and the positon price to calculate the closing PnL. If not, the system will use the average position-closing price and the open price to calculate the closing PnL.

PnL (Position-closing) represents the cumulative PnL of the closed position from position opening to position closing, including the settled PnL of the position. It’s calculated by using the position-closing price and the open price.

Example 1: Tom bought 100 conts BTC/USDT swaps of long positions at the price of 10,000 USDT at 8:30 am (GMT+8) and closed the position at the price of 11,000 USDT at 13:00 pm, then the closing PnL = PnL (position closing) = (11,000 – 10,000) * 100 * 0.001 = 100 USDT.

Example 2: Tom bought 100 conts BTC/USDT swaps of long positions at the price of 10,000 USDT at 8:30 am (GMT+8), and closed this position at the price of 13,000 USDT at 17:00, while the system has proceeded a settlement for this position at 16:00 with the settlement price 12,000 USDT:

1. At 16:00, the system has proceeded a settlement for this position and transferred the unrealized PnL (the PnL between the open price 10,000 USDT to the settlement price 12,000 USDT) to the realized PnL, then transferred to the account balance. The position price has been adjusted to 12,000 USDT after the settlement. Therefore, the closing PnL refers to the PnL from the last settlement to the position closing, that is, the closing PnL = (13,000 – 12,000) * 100 * 0.001 = 100 USDT;

1. PnL (Position-closing) represents the cumulative PnL of the closed position from position opening to position closing, including the settled PnL of the position. It is also the actual PnL from position opening to positon closing. The open price of the position is 10,000 USDT, and the position-closing price is 13,000 USDT, then the PnL (positon-closing) = (13,000 – 10,000) * 100 * 0.001 = 300 USDT;

In conclusion, the closing PnL and the PnL displayed on the front end will not affect the actual PnL of users’ position.