CoinEx | Top Concern for Futures Traders: How to Calculate Unrealized PNL and Realized PNL?

CoinEx
4 min readApr 6, 2022

--

When trading futures, users earn profits and suffer losses. Here, there are two types of profits and losses (PNL): the Unrealized PNL from open positions and the Realized PNL from closed positions. Since the PNL of futures trading is the top concern for most futures traders, today, we will dive into the calculation of the Unrealized PNL and the Realized PNL.

I. The Unrealized PNL

1. What is the Unrealized PNL?

The Unrealized PNL refers to a user’s profits and losses arising from his/her open (unclosed) positions. The approximate Unrealized PNL of closing the existing position will be estimated according to a Fair Mark Price, and the calculation varies along with the Mark Price. It should be noted that CoinEx uses a Fair Mark Price to determine the Unrealized PNL, thereby avoiding price manipulations.

Generally speaking, the Unrealized PNL is based on the difference between the Average Open Price and the Mark Price and will be shown in the position information once a position is opened. This figure indicates the estimated PNL of a position.

2. How is the Unrealized PNL calculated?

When trading futures, the Unrealized PNL of linear contracts is calculated differently from that of inverse contracts. Moreover, the calculation of the Unrealized PNL for long positions and short positions also differs.

(The formulas below are from CoinEx Futures)

(1) Linear contracts

(Long) Unrealized PNL = Position Qty * (Mark Price — Open Price)

(Short) Unrealized PNL = Position Qty * (Open Price — Mark Price)

For instance, suppose User A starts a long position of 1 BTC in the BTC/USDT linear contract market when the BTC price stands at 50,000 USDT. If the Mark Price of the market is set at 53,000 USDT, the Unrealized PNL of User A’s long position will be (excluding fees):

1 BTC * (53,000 USDT — 50,000 USDT) = 2,000 USDT

(2) Inverse contracts

(Long) Unrealized PNL = Contract Amount * Contract Value * (1 / Avg. Open Price — 1 / Mark Price)

(Short) Unrealized PNL = Contract Amount * Contract Value * (1 / Mark Price — 1 / Avg. Open Price)

Suppose User A starts a long position of 100,000 contracts in the BTC/USDT inverse contract market with an estimated cost of 0.2 BTC when the BTC price stands at 50,000 USDT. If the current Mark Price is set at 55,000 USDT and the Average Open Price is 53,000 USDT, the Unrealized PNL of User A’s long position will be:

100,000 * 0.2 BTC * (1/53,000–1/55,000) = 0.0137 BTC

II. The Realized PNL

1. What is the Realized PNL?

The Unrealized PNL will not affect a user’s final PNL, while the Realized PNL indicates his/her final PNL, which includes the Funding Fee, Transaction Fee, and the PNL of decreasing/closing the position. In short, the Realized PNL is an indicator of the user’s real profits and losses after a position is closed. When the user decreases or closes a position, the Realized PNL will be settled according to the Closing Value and the Open Value.

It is noteworthy that holders of long positions need to pay or collect the Funding Fee every 8 hours every day. When a collection or payment is completed, at least one Realized PNL will be settled. Moreover, when a user is selling or buying futures, he/she needs to pay a transaction fee. When the transaction fee is paid, there will also be a position with the Realized PNL.

2. How is the Realized PNL calculated?

(1) Linear contracts

(Long) Realized PNL = Position Qty * (Close Price — Open Price)

(Short) Realized PNL = Position Qty * (Open Price — Close Price)

Suppose User A starts a long position of 1 BTC in the BTC/USDT market at 50,000 USDT and closes the position at 55,000 USDT, and the Realized PNL of User A’s long position will be:

1 BTC * (55,000–50,000) = 5,000 USDT

(2) Inverse contracts

(Long) Realized PNL = Contract Amount * Contract Value * (1 / Avg. Open Price — 1 / Avg. Close Price)

(Short) Realized PNL = Contract Amount * Contract Value * (1 / Avg. Close Price — 1 / Avg. Open Price)

Suppose User A starts a long position of 100,000 contracts in the BTC/USDT inverse contract market with an estimated cost of 0.2 BTC when the BTC price stands at 50,000 USDT. If the position is closed at 56,000 USDT, the Realized PNL of User A’s long position will be:

100,000 * 0.2 BTC * (1/53,000–1/56,000) = 0.0202 BTC

As mentioned above, to avoid price manipulations, CoinEx calculates the Unrealized PNL with a Fair Mark Price. Meanwhile, the Actual PNL is determined by the actual price at which a position is closed. Therefore, when the trading price differs from the Mark Price, the Unrealized PNL will also differ from the Actual PNL.

--

--