Calculations

  1. Average entry price calculation for positions

ScenarioSub-scenarioAverage Entry Price

New position opened

AvgEntryPrice = TradePrice

New trade for an existing position

Side changed, i.e. long became short or short became long

AvgEntryPrice = TradePrice

Size reduced, i.e. long reduces in size but remains long, or, short reduces in size but remains short

AvgEntryPrice = LastAvgEntryPrice

Size increased, i.e. long increase in size but remains long, or, short increases in size but remains short

AvgEntryPrice = (PreviousSize * LastAvgEntryPrice + TradedSize * TradePrice) / NewSize

P.S.: Fees is not considered while calculating average entry price of positions, total fees for a position is shown separately

  1. Realised Profit and Loss calculation for trades

ScenarioSub-scenarioRealised Pnl

New position opened

Realised Pnl = 0

New trade for an existing position

Side changed, i.e. long became short or short became long

Realised Pnl = Pnl for the side which was closed Unrealised Pnl for position is set to 0

Size reduced, i.e. long reduces in size but remains long, or, short reduces in size but remains short

Realised Pnl = (InitialSize - FinalSize) * (TradePrice - LastAvgEntryPrice)

Size increased, i.e. long increases in size but remains long, or, short increases in size but remains short

Realised Pnl = 0

  1. Realised funding calculation for trades

ScenarioSub-scenarioRealised funding

New position opened

Realised funding = 0

New trade for an existing position

Side changed, i.e. long became short or short became long

Realised funding = Funding accumulated since the last trade Unrealised funding for corresponding position is set to 0

Size reduced, i.e. long reduces in size but remains long, or, short reduces in size but remains short

Realised funding = Funding accumulated since last trade Unrealised funding for corresponding position is set to 0

Size increased, i.e. long increases in size but remains long, or, short increases in size but remains short

Realised funding = Funding accumulated since last trade Unrealised funding for corresponding position is set to 0

  1. Fees calculation for orders The fee displayed for orders covers the total fee incurred from placing the order to creating the position (There is a delay between aforementioned events due to delayed order mechanism of Synthetix)

Type of orderFees calculation

Standard order

Fees = keeper fee + execution fee

Limit order

Fees = limit order fees + keeper fee + execution fee

  1. Unrealised funding calculation for positions

Funding shown in positions tab is the unrealised funding accrued for the position since the last trade placed by the user. P.S.: There is a cron which updates the unrealised funding for a position every 3 minutes, so the unrealised funding shown is not always accurate.

  1. Unrealized Pnl calculation

Unrealized Pnl = (currentPrice - latestInteractionPrice) * size + accruedFunding

  1. Realised Pnl calculation for liquidations

Realised Pnl for a liquidation can be seen in the History tab. A new trade is created with side field set to Liquidation. Realised pnl for a liquidation trade is set to the total margin present in the market when the position was liquidated.