Account Equity and PnL Calculation
- Hướng dẫn Coin-M Vĩnh cửu
Equity of Perpetual Swaps Account
Perpetual swaps account consists of equity, deposit, RPL and UPL. Means all assets of this contract in your accounts:
Equity = Deposit + realized profits/losses + unrealized profits/losses
Account Balance
Balance: margin of your perpetual swaps account, it is also the amount transferred from your spot account. After settlement, your RPL will be added to your balance.
Unrealized Profit & Loss(UPL)
The profit / loss generated by a position that has yet to be closed,which will change with the latest price.
Long side:
UPL of contract = (1 / position price - 1 / latest price) * Number of contracts * Contract face value
Short side:
UPL of contract = (1 / latest price - 1 / position price) * Number of contracts * Contract face value
For example: A user opened 100-lotsof long BTC perpetual swaps positions at position price 5000 USD/BTC, and the last traded price is 8000 USD/BTC. The UPL of contract will be (1/ 5000 - 1/ 8000) * 100*100 = 0.75 BTC.
Realized Profit & Loss(RPL)
Realized PnL refers to the profit or loss of a closed position, which includes the transaction fees, funding paid or received by users. RPL is in fact the profit / loss generated after closing position(s).
Realized profit and loss cannot be transferred out of the contract account before clearing/delivery of the contract.
RPL of contract:
Long side:
RPL of contract = ( 1 / position price - 1 / close price ) * Number of contracts * Contract face value
Short side:
RPL of contract = ( 1 / close price - 1 / position price ) * Number of contracts * Contract face value
For example: An user opened 100-lotsof long BTC positions at position price 5000 USD/BTC, and the last traded price is 4000 USD/BTC. The realized profit & loss of contracts= (1/5000-1/4000)*100*100 = -0.5BTC.
Entry Price
Entry 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 in the same direction will be calculated jointly.
Assume Tom buys/sells 100 conts BTC/USD swaps (100 USD/contract) at the price of 10,000 USD and buys/sells another 200 conts at the price of 11,000 USD, then the Entry Price of this position= [100 * (100 + 200)] / [ (100 * 100 / 10,000) + (100 * 200 / 11,000)] = 10,645.1 USD.
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 entry Price is to be closed, instead it will use the average price as the cost price to calculate PnL.
For example: Tom bought 100 conts BTC/USD swaps (100 USD/contract) of long positions at 8:30 am (GMT+8) at the price of 10,000 USD, and bought another 200 conts at the price of 11,000 USD at 12:30 pm (GMT+8), then the entry price = position price = [100 * (100 + 200)] / [(100 * 100 / 10,000) + (100 * 200 / 11,000)] = 10,645.1 USD.
- Before the settlement, the entry price of the user’s position is equal to the position price 10,645.16 USD. Assume the settlement price at 16:00 (GMT+8) is 12,000 USD, 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 USD after the settlement, while the entry price keeps unchanged, which is at 10,645.16 USD.
- After the settlement, assume Tom increases another 200 conts of long positions at the price of 12,800 USD at 18:00 (GMT+8), then the entry price and position price of the position are as below:
- a) Entry price = [100 * (300 + 200)] / [ (100 * 300 / 10,645.16) + (100 * 200 / 12,800)] = 11,413.7 USD;
- b) Position price = [100 * (300 + 200)] / [(100 * 300 / 12,000) + (100 * 200 / 12,800)] = 12,307.6 USD;
- If the user closes part of this position, both the entry price and the position price will not change.
PnL and PnL Ratio
PnL (Positons) 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/USD swaps (100 USD/contract) with 10x leverage to open a long position at the price of 10,000 USD, and the order is completely filled. When the latest price rises to 11,500 USD, the PnL and PnL Ratio are calculated as below:
PnL (Positions) = (1 / 10,000 – 1 / 11,500) * 100 * 100 = 0.1304 BTC;
PnL ratio = 0.1304 / (100 * 100 / 10,000 / 10) = 130.43%.
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 entry 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 entry price.
Example 1: Tom bought 100 conts BTC/USD swaps of long positions at the price of 10,000 USD at 8:30 am (GMT+8) and closed the position at the price of 11,000 USD at 13:00 pm, then the closing PnL = PnL (Position-closing) = (1 / 10,000 – 1 / 11,000) * 100 * 100 = 0.0909 BTC;
Example 2: Tom bought 100 conts BTC/USD swaps of long positions at the price of 10,000 USD at 8:30 am (GMT+8), and closed this position at the price of 13,000 USD at 17:00, while the system has proceeded a settlement for this position at 16:00 with the settlement price 12,000 USD:
- At 16:00, the system has proceeded a settlement for this position and transferred the unrealized PnL (the PnL between the entry price 10,000 USD to the settlement price 12,000 USD) to the realized PnL, then transferred to the account balance. The position price has been adjusted to 12,000 USD after the settlement. Therefore, the closing PnL refers to the PnL from the last settlement to the position closing, that is, the closing PnL = (1 / 12,000 – 1 / 13,000) * 100 * 100 = 0.0641 BTC;
- 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 entry price of the position is 10,000 USD, and the position-closing price is 13,000 USD, then the PnL (positon-closing) = (1 / 10,000 – 1 / 13,000) * 100 * 100 = 0.2307 BTC.
In conclusion, the closing PnL and the PnL displayed on the front end will not affect the actual PnL of users’ position.