Unrealized PNL and Realized PNL
The unrealized PNL is based on the difference between the average open price and the mark price. It will be reflected in your position information after you successfully open the position. This value is estimated PNL of your position. The calculations are as follows:
(Long Positions) Unrealized PNL = Contract Amount * Contract Value * (1 / Avg. Open Price - 1 / Mark Price)
(Short Positions) Unrealized PNL = Contract Amount * Contract Value * (1 / Mark Price - 1 / Avg. Open Price)
Unrealized PNL will not affect the user's final PNL, and the realized PNL is the user's final PNL. The realized PNL includes fundings, trading fees and PNL of lightening and closing the position.
Buyers and sellers of perpetual swap contracts need to pay or collect the funding every 8 hours every day, and when any one of them completes the collection or payment, there will be at least one trader who has realized PNL.
When the user is selling or buying, the user needs to pay a certain fee, and when a payment of the fee is completed, there will be a position with realized PNL.
When the user lightens the position or closes the position, the realized PNL will be settled according to the closing value and the open value. The formulas are as follows:
(Long Positions) Realized PNL = Contract Amount * Contract Value * (1 / Avg. Open Price - 1 / Avg. Close Price);
(Short Positions) Realized PNL = Contract Amount * Contract Value * (1 / Avg. Close Price - 1 / Avg. Open Price)