Account Equity and PnL Calculation
- USDⓈ-margined Contracts guides
Account equity for USDT-margined contract's formulas are as below:
Margin Account Equity = Account Balance + Current-period Realized PnL of All Contracts + Current-period Unrealized of All Contracts
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 is the profit or loss of users’ current positions and would change with the last price.
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）/Position Price * Long Positions (USDT)
Unrealized PnL (Short) =（Position Price – Last Price）/Position Price * Short Positions (USDT)
Tom holds a long position of 100 USDT BTC/USDT swaps with position price of 5,000 USDT; At the same time, he holds a long position of 50 USDT BTC/USDT quarterly 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) =（8000 - 5000）/5000* 100 = 60 USDT。
Unrealized PnL of BTC/USDT quarterly (long) =（8500 - 5200）/5000 * 50 = 31.73 USDT
Unrealized PnL of the cross margin account = 60 + 31.73 = 91.73 USDT
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
Tom holds a long position of 100 USDT 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 USDT 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) =（4000 - 5000）/ 5000 * 100 = -20 USDT
Realized PnL of BTC/USDT Quarterly (long) =（5500 - 5200）/ 5200 * 50 = 2.88 USDT
Transaction fees paid for closing the position of BTC/USDT swaps = (4000/5000) * 100 * 0.05% = 0.04 USDT
Transaction fees paid for closing the position of BTC/USDT quarterly = （5500 / 5200）* 50 * 0.05% = 0.03 USDT
At this time, the closing PnL and the transaction fee will be merged into the realized PnL (-20 +2.88 -0.04 -0.03= -17.19 USDT ).
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 USDT 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 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 USDT 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 (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) = ( 11500 – 10000 ) /10000 * 100 = 15 USDT
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 100USDT 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) = （ 11000 – 10000 ）/10000* 100 = 10 USDT .
Example 2: Tom opened a long position of 100USDT 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 =（ 13000 – 12000 ）/12000* 100 = 8.33 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) = （ 13000 – 10000 ）/10000* 100 = 30 USDT ;
In conclusion, the closing PnL and the PnL displayed on the front end will not affect the actual PnL of users’ position.