Profit & Loss (PnL) and how it's calculated

Profit and Loss (PnL) indicator reflects the Profit or Loss of a deal. Reflected PnL is calculated in 2 different ways, depending on if a deal is still currently Open or if it has already been Closed.

For open deals Realized PnL and Unrealized PnL are taken into account. The potential profit from the deal refers to the Unrealized PnL. Realized PNL in opened deals equals to already paid commissions.

PnL is not reflected in Open positions. It can be calculated by adding Realized PnL + Unrealized PnL. Calculating Unrealized PnL of Open positions requires the use of AskPrice and BidPrice, while calculating Unrealized PnL of Closed positions requires the use ClosePrice)

How to calculate PnL in OPEN positions

The general formulas for calculating PnL of OPEN positions:

PnL = Realized PnL + Unrealized PnL, where:

Realized PnL = - OpenOrderCommission - Funding

Unrealized PnL (Long) = SizeUSD * Multiplier * (BidPrice- OpenPrice)/OpenPrice

Unrealized PnL (Short) = SizeUSD * Multiplier * (OpenPrice - AskPrice)/OpenPrice

Note: CloseOrderCommision is NOT included in PnL until a position has been closed.

EXAMPLE:

Parameters of an OPEN position: Open position, 0.01 BTC, opened with Limit, Long, OpenOrderCommission, Funding charged 1 time

  1. First we must calculate the OpenOrderCommission and Funding:
    • OpenOrderCommission = SizeBTC * MakerFee = 0.01 * 0.001 = 0.00001
    • Funding = SizeBTC * FundingFee = 0.01 * 0.005 = 0.00005
  2. Now we must calculate Realized PnL and Unrealized PnL:
    • Realized PnL = OpenOrderCommission - Funding = -0.00001 - 0.00005 = - 0.00006
    • Unrealized PnL (Long) = SizeUSD * Multiplier * (BidPrice- OpenPrice)/OpenPrice = 100 * 0.0001 * (11000 - 10000)/10000 = 0.001
  3. Now, the final step is calculating PnL. As seen above, the Realized PnL= 0.00006 and Unrealized PnL = 0.001:
    • PnL(Long) = Realized PnL + Unrealized PnL = -0.00006 + 0.001 = 0.00094

How to calculate PnL in CLOSED positions

The general formulas for calculating PnL of CLOSED positions:

PnL = Realized PnL + Unrealized PnL - CloseOrderCommission

Unrealized PnL (Long) = SizeUSD * Multiplier * (ClosePrice- OpenPrice)/OpenPrice

Unrealized PnL (Short) = SizeUSD * Multiplier * (OpenPrice - ClosePrice)/OpenPrice

CloseOrderCommission = TakerFee * SizeBTC

EXAMPLE:

Parameters of a CLOSED position: Сlosed position, opened at Market, closed at Market, Long, Funding charged 1 time

  1. First we must calculate the CloseOrderCommission:
    • CloseOrderCommission = TakerFee * SizeBTC = 0.002 * 0.01 = 0.00002
  2. Next, we must calculate Realized PnL and Unrealized PnL:
    • Realized PnL = OpenOrderCommission - Funding = -0.01*0.002 - 0.01*0.005 = -0.00007
    • Unrealized PnL (Long) = SizeUSD * Multiplier * (ClosePrice - OpenPrice)/OpenPrice = 100 * 0.0001 * (11000-10000)/10000 = 0.001
  3. Now, the final step is calculating PnL. As seen above, the Unrealized PnL= 0.00006 and Realized PnL = 0.001:
    • PnL = Realized PnL + Unrealized PnL - CloseOrderCommission = - 0.00007 + 0.001 - 0.00002 = 0.00091