# Position PNL Calculation

Last updated 24/05/2023
Profit calculation is based on all orders or remaining tokens in the position. PNL calculation process varies based on the position type. Below are the formulas for each type.

## 1. Based on all orders

PnL includes ALL realized profit/loss from partial position closing + the estimated profit/loss that would be realized if the position were closed at the current price.
PNL = [(Partial closing volume + (Current price x Position quantity)) - Opening volume] x Direction - Commission + Funding
Direction = 1 if LONG Direction = -1 if SHORT
Example with a 0.1% commission:
1. 1.
2. 2.
sells 0.8 BTC at 25,000 USDT (partial profit will be 4,000 excluding commissions).
Total position PnL at current exchange rate 22,000 USDT will be calculated as follows:
PnL = (25 000 x 0.8 + 22 000 x 0.2 - 20 000 x 1 ) x 1 - ( 25 000 x 0.8 + 22 000 x 0.2 + 20 000 x 1 ) x 0.001 = 4355.6 USDT
In this example, with no funding rate, the profit would either increase or decrease based on the sign of the funding amount.

## 2. Based on remaining position coins

PnL is calculated based only on the remaining coins in the position when it is closed at the current price.
PNL = (Current Price - Position Price) x Position Quantity) - Commission + Funding
Direction = 1 if LONG Direction = -1 if SHORT
Example with 0.1% commission:
1. 1.
2. 2.
sells 0.8 BTC at 25,000 USDT (partial profit will be 4,000 excluding commissions).
3. 3.
The position price is equal to the entry price (if the position price calculation formula excluding partial closing is enabled).
The PnL for the remaining 0.2 BTC, at the current exchange rate of the currency pair, which is 22,000 USDT, will be calculated as follows:
PnL = (22 000 - 20 000) x 0.2 - 22 000 x 0.2 х 0.001 х 2 = 391.2 USDT
In this example, with no funding rate, the profit would either increase or decrease based on the sign of the funding amount.