In crypto derivatives, there are two types of PnLs, realized and unrealized. In perpetual contracts, when you have open positions that are susceptible to change based on market conditions, the PnL is referred to as unrealized. When you close your positions, the unrealized PnL becomes realized PnL (either partially or entirely). Here, we will discuss how both unrealized and realized PnL is calculated.
Example 1, Buying and Selling
Perpetual Contracts
Suppose you are long 1,000 BTC-USD contracts with an average entry price of $1,000. The current price of BTC-USD is $1,250.
Your unrealised PnL is based on the difference between the average entry price and the current price.
Unrealised Profit = ($1/$1,000 - $1/$1,250) * 1,000 = 0.20 BTC
Now, the last price of BTC-USD is $1,500.
You decide to sell 500 BTCUSD contracts at $1,500 and realise some profit.
Your realised PnL is based on the difference between his average entry price and the price at which you sell BTC-USD contracts.
Realised Profit = ($1/1,000 - $1/$1,500) * 500 = 0.17 BTC
Realised PNL is based on where you can actually buy or sell your position, which in most cases is not the mark price. If Ram had sold his 500 contracts at the lost price of $1,250, he would have a realised profit of 0.10 BTC.
Example 2, Funding Fees
Suppose you are trading a BTC-USD perpetual contract. Every 8 hours, there is a funding fee. The funding fee is currently 1%, and is paid from buyers to sellers.
You currently long 100 BTC worth of BTC-USD contracts. The position has no realised PnL. It is funding time and you must pay 1 BTC (1% of 100BTC) to the seller. After the funding fee has been paid, your realised PnL is now -1 BTC.
If you are short 100 BTC worth of BTC-USD contracts instead,you will receive 1 BTC (from the buyer of your 100BTC). Your realised PnL will then be 1 BTC.
Examples
Long BTCUSD Perpetual Contract Example
The following examples do not take Premium into consideration.
Perpetual Contracts
Realised Profit = ($1/1,000 - $1/$1,500) * 500 = 0.17 BTC
Margin Currency = Bitcoin
Underlying Index = BTC OKEx Indices
Interest Quote Index = USD Lending Rate in the OKEx Indices (.USDBON)
Interest Base Index = BTC Lending Rate in the OKEx Indices (.BTCBON)
Funding Timestamp = 02:00 UTC, 10:00 UTC, and 18:00 UTC
Day 1, 08:00 UTC
You go Long on 150,000 BTC-USD Perpetual Contracts at a price of 7500 USD.
BTC Position Value = 150,000 Contracts * 1 USD * 1/7500 = 20 BTC
Day 1, 10:00 UTC
You hold the position over the Funding Timestamp at 10:00 UTC+00 and exchange the Funding Amount. The amount you pay is determined as shown below:
The BTCUSD spot price is currently 7500 USD.
Interest Quote Index = 1.00% per day
Interest Base Index = 0.25% per day
Funding Rate = (1.00% - 0.25%) / 3 = 0.25%
Funding Amount = Position Value * Funding Rate = 20 BTC * 0.25% = 0.05 BTC
The Funding Amount is positive, so you need to pay since you are Long, and your counterpart who is Short receives this 0.05 BTC.
Day 1, 16:00 UTC
The BTCUSD contract price increases to 8000 USD. You close your position by selling the 150,000 BTCUSD contracts. Since you do this before the next Funding Timestamp at 18:00 UTC+00, you do not need to pay the Funding Amount at that time.
You made 1.25 BTC profit from the increase in the value of BTCUSD: PnL = 150,000 * 1 USD * (1/7500 - 1/8000) = 1.25 BTC
You exchanged 0.05 BTC in funding, and your total profit is 1.2 BTC (1.25 BTC - 0.05 BTC).