Account Equity and PnL Calculation

Account Equity

Account equity for USDT-margined contract is divided into the isolated margin account equity and the cross margin account equity. Isolated margin account equity refers to the equity of each USDT-margined swap in support of the isolated margin mode, which is calculated separately. Cross margin account equity refers to the total equity of all USDT-margined contracts (including swaps and futures) in support of the cross margin mode. The formulas are as below:

Isolated Margin Account Equity = Account Balance + Current-period Realized PnL + Current-period Unrealized PnL

Cross Margin Account Equity = Account Balance + Current-period Realized PnL of All Contracts + Current-period Unrealized of All Contracts

Account Balance

Account balance is the asset quantity a user has in his USDT-margined contract 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 - Current-period Transfer_out

Unrealized PnL

Unrealized PnL is the profit or loss of users’ current positions and would change with the last price.

In the isolated margin mode, unrealized PnL is profit or loss incurred from users’ existing positions of a certain USDT-margined swap.

In the cross margin mode, unrealized PnL is the profit and loss incurred from users’ all existing positions of all USDT-margined swaps and USDT-margined futures in the cross margin mode.

Unrealized PnL (Long) =（Last Price – Position Price）* Long Positions (cont) * Contract Face Value

Unrealized PnL (Short) =（Position Price – Last Price）* Short Positions (cont) * Contract Face Value

For instance,

In the isolated margin mode, Tom holds a long position of 100 cont BTC/USDT swaps (face value is 0.001BTC/cont) with the position price of 5,000 USDT. Assume the last price is 8,000 USDT, then

Unrealized PnL is8,000-5,000* 100 * 0.001 = 300 USDT.

In the cross margin mode, Tom holds a long position of 100 conts BTC/USDT swaps (face value=0.001 BTC/cont) with position price of 5,000 USDT; At the same time, he holds a long position of 50 conts BTC/USDT quarterly (face value=0.001 BTC/cont) with position price of 5,200 USDT. Assume the last price of BTC/USDT swaps rises to 8,000 USDT and that of BTC/USDT quarterly rises to 8,500 USDT, then

Unrealized PnL of BTC/USDT swaps (long) =8,000 – 5,000* 0.001 * 100 = 300 USDT

Unrealized PnL of BTC/USDT quarterly (long) =8,500 – 5,200* 0.001 * 50 = 165 USDT

Unrealized PnL of the cross margin account = 300 + 165 = 465 USDT

Realized PnL

Realized PnL refers to the profit or loss of a closed position, which includes the transaction fees, funding paid or received by users. Realized PnL cannot be transferred out from USDT-margined contract account before settlement.

Realized PnL (Long) =（Position Closing price– Position Price）* Long Positions (cont) * Contract Face Value

Realized PnL (Short) =（Position Price – Position Closing price）* Short Positions (cont) * Contract Face Value

For instance,

In the isolated margin mode, Tom holds a long position of 100 conts BTC/USDT swaps (face value=0.001BTC/cont) with position price of 5,000 USDT, assume that the position closing price is 4,000 USDT/BTC (all filled as taker at a rate of 0.05%), then

Realized PnL (Long) = (4,000 – 5,000) * 0.001 * 100 = 100 USDT

Transaction fees paid for closing the position = 100 * 0.001 * 4,000 * 0.05% = 0.2 USDT

At this time, the closing PnL and the transaction fee will be merged into the realized PnL (-100-0.25=-100.2 USDT).

In cross margin mode, Tom holds a long position of 100 conts BTC/USDT swaps (face value=0.001BTC/cont) with position price of 5,000 USDT, if the position closing price is 4,000 USDT (all filled as taker at a rate of 0.05%). And he holds a long position of 50 conts BTC/USDT quarterly (face value= 0.001BTC/cont) with position price of 5,200 USDT. Assume that the position closing price is 5,500 USDT (all filled as taker at a rate of 0.05%), then

Realized PnL of BTC/USDT swaps (long) =4,000 – 5,000* 0.001 * 100 = 100 USDT

Realized PnL of BTC/USDT Quarterly (long) =5,500 – 5,200* 0.001 * 50 = 15 USDT

Transaction fees paid for closing the position of BTC/USDT swaps = 100 * 0.001 * 4000 * 0.05% = 0.2 USDT

Transaction fees paid for closing the position of BTC/USDT quarterly = 50 * 0.001 * 5,500 * 0.05% = 0.1375 USDT

At this time, the closing PnL and the transaction fee will be merged into the realized PnL (-100+15-0.2-0.1375= -85.3375 USDT).

Entry price

Entry price is the average cost price and the actual cost of opening a position. It will not change after the settlement. Under the same type of contract, positions of the same pair in the same direction and same mode will be calculated jointly.

Assume Tom bought 100 conts BTC/USDT swaps at the price of 10,000 USDT and bought another 200 conts in the same direction at the price of 11,000 USDT, then the entry price = (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. This price will be adjusted upon each settlement or position increases, 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 with which position or at which open price is used to close, it will use the position price as the cost price to calculate PnL instead.

For example, Tom opened a long position of 100 conts BTC/USDT swaps at 00:30 am (UTC) at the price of 10,000 USDT, and opened another 200 conts at the price of 11,000 USDT at 4:30 am (UTC), then Entry Price = Position Price = (100 * 10,000 + 200 * 11,000) / (100 + 200) = 10,666.66 USDT.

1. Before the settlement, the entry price of the user’s position is equal to the position price 10,666.66 USDT. Assume the settlement price at 8:00 (UTC) is 12,000 USDT, the system will calculate the realized PnL with the settlement price and transfer it to the account balance. Meanwhile, the position price will be adjusted to 12,000 USDT after the settlement, while the entry price keeps unchanged (10,666.66 USDT).

2. After the settlement, assume Tom opens another 200 conts BTC/USDT swaps in the same direction at the price of 12,800 USDT at 10:00 am (UTC), then the entry price and position price of the position are calculated as below:
Entry Price = (300 * 10,666.66 + 200 * 12,800) / (300 + 200) = 11,519.99 USDT
Position Price = (300 * 12,000 + 200 * 12,800) / (300 + 200) = 12,320.00 USDT

3. If the user closes part of this position, both the entry price and the position price will not change.

PnL (Position) 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 / Margin Required for Opening a Position.

For instance, Tom opened a long position of 100 conts BTC/USDT swaps with 10x leverage at the price of 10,000 USDT and the order was completely filled. When the last price rises to 11,500 USDT, the PnL and PnL Ratio are calculated as below:
PnL (Position) = ( 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 last 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 entry price to calculate the closing PnL.

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

Example 1: Tom opened a long position of 100 conts BTC/USDT swaps at the price of 10,000 USDT at 00:30 am (UTC), and closed the position at the price of 11,000 USDT at 5:00 am (UTC), then the closing PnL = PnL (position closing) = (11,000 – 10,000) * 100 * 0.001 = 100 USDT.

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

1. At 8:00 am (UTC), the system has proceeded a settlement for this position and transferred the unrealized PnL (the PnL between the entry 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 closing, that is, the closing PnL = (13,000 – 12,000) * 100 * 0.001 = 100 USDT;

2. PnL (Position-closing) represents the cumulative PnL of the closed position from the opening to the closing, including the settled PnL of the position. It is also the actual PnL of the position from the opening to the closing. The entry 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.