PnL Calculation

How to Calculate Profit and Loss for Perpetual Contracts

What's PnL?

PnL is the profit or loss a trader makes on their trades. It can be realized or unrealized, and it takes into account factors such as trading fees, funding fees, and position size.

The unrealized PnL is the profit or loss that a trader has on their open positions, and it changes in response to market movements. Realized PnL is the profit or loss a trader realizes when they close their position, taking into account the executed price of the position, trading fees, and funding fees.

The calculation of profit and loss (PnL) is based on the collateral, taking into account both trading direction and position size. At NFEX, the perpetual contracts are linear contracts, meaning that they are quoted, denominated, and settled in ETH.

The unrealized profits and losses are calculated based on theMark Price, whereas the realized profits and losses are calculated based on the executed price of the position.

Calculation

1. Unrealized PnL

The unrealized PnL of open positions is the profit or loss that a trader would make if they were to close their position at the current market price. It is calculated based on the difference between the trader's average open price and the current mark price of the contract and is denominated in ETH, since all perpetual contracts on NFEX are settled in ETH. This value changes in real-time as the market price of the underlying asset fluctuates, and can be positive or negative depending on the direction of the trade and the current market conditions.

The calculation is as below:

Long position:

UnrealizedPnL=NumberofContract×ContractSize×(MarkPrice−OpenPrice)Unrealized PnL=Number of Contract\times Contract Size \times(Mark Price - Open Price)

Short Position:

UnrealizedPnL=NumberofContract×ContractSize×(OpenPrice−MarkPrice)Unrealized PnL=Number of Contract\times Contract Size \times(Open Price-Mark Price)

2. Realized PnL

Realized PnL is the difference between the open price and close price when the position of the contract is closed out. The value is calculated in ETH and has no direct relation to Mark Price but to the last traded price of the closed position. The funding payments and trading fees will be added to the realized PnL. The calculation is as below:

RealizedPnL=ClosingPnL−OpenOrderFee−CloseOrderFee±FundingRealized PnL=Closing PnL- OpenOrderFee- CloseOrderFee\pm Funding

Where:

  • for long positions, ClosingPnL=NumberofContract×ContractSize×(ExecutedPrice−OpenPrice)Closing PnL =Number of Contract \times Contract Size \times (Executed Price - Open Price )

  • for short positions, ClosingPnL=NumberofContract×ContractSize×(OpenPrice−ExecutedPrice)Closing PnL =Number of Contract \times Contract Size \times (Open Price - Executed Price)

Please Note:

The constantly-changing unrealized PnL will increase or decrease the available collateral for maintenance margin and thus become a primary driver for liquidations.

Last updated