Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

P&L Calculations

Last updated: Mar 11, 2026

On Synthetix, positions, margin, and settlement flows are tracked by the protocol. The UI typically surfaces convenience metrics like average entry price, unrealized PnL, and realized or closed PnL by deriving them from the position state and fills.

Perps

What counts as opening vs closing

A trade is opening when it increases the absolute position size in the same direction. A trade is closing when it reduces an existing position, partially or fully. If a trade crosses through zero, it's effectively a close plus an open in the opposite direction.

Entry price (average entry)

  • Opening or add-to-position: average entry is updated as a size-weighted average of the existing entry price and the new fill price.
  • Closing or reduce: the entry price for the remaining position stays the same.
  • Flip (close then open opposite): the portion that opens a new position gets a new entry price based on the fill or fills that created it.
new_avg_entry = (existing_size × existing_entry + new_size × new_price) / (existing_size + new_size)
Average entry updates only when you add to a position in the same direction.

Worked example

  • Existing: 1 BTC long at $100,000
  • You add: 0.5 BTC at $102,000
new_avg_entry = (1 × $100,000 + 0.5 × $102,000) / 1.5
              = ($100,000 + $51,000) / 1.5
              = $100,667

Unrealized PnL

Unrealized PnL is typically computed from the current mark price versus entry price, multiplied by signed position size:

Long:  Unrealized PnL = (mark_price - avg_entry_price) × position_size
Short: Unrealized PnL = (avg_entry_price - mark_price) × position_size
Unrealized PnL moves with the mark price and changes continuously while the position remains open.

Worked example

You open a long position:

  • Size: 0.5 BTC
  • Entry price: $100,000
  • Current mark price: $105,000
Unrealized PnL = ($105,000 - $100,000) × 0.5 BTC = +$2,500

Realized / Closed PnL

For any closing portion of a trade, realized PnL is the portion closed times the difference between the fill price and entry price:

Long close:  Realized PnL = (close_price - avg_entry_price) × closed_size
Short close: Realized PnL = (avg_entry_price - close_price) × closed_size
Realized PnL applies only to the portion of the position that has actually been closed.

Closed PnL shown in the UI is realized PnL not including other deductions such as funding or fees.

Worked example

You have a long position:

  • Size: 1 BTC at average entry $95,000
  • You close 0.3 BTC at $100,000
Realized PnL = ($100,000 - $95,000) × 0.3 = +$1,500

Your remaining position continues with unrealized PnL based on the original entry price.

How fees affect PnL

Trading fees are deducted from your subaccount balance at execution. They are not included in the gross PnL figures shown for the position itself.

Net PnL = Realized PnL - (opening_fee + closing_fee)

Worked example

  • 1 BTC long, opened at $100,000, closed at $105,000
  • Taker fee: 0.05% both ways
Opening fee = $100,000 × 0.0005 = $50
Closing fee = $105,000 × 0.0005 = $52.50
Gross PnL   = ($105,000 - $100,000) × 1 = $5,000
Net PnL     = $5,000 - $50 - $52.50 = $4,897.50

How funding affects PnL

Funding payments settle to your subaccount balance separately from trading PnL, but they affect your effective return.

Worked example

  • 1 BTC long at $100,000 held for 24 hours
  • Funding rate: +0.01% per 8-hour period
  • Three funding periods
Funding paid = $100,000 × 0.0001 × 3 = $30

Your net return is reduced by $30 relative to your gross PnL.

Return on margin

Because you trade with leverage, PnL is large relative to the margin you deposited. Return on margin is:

ROM = PnL / initial_margin

Worked example

  • 0.1 BTC long at $100,000 = $10,000 notional
  • 10x leverage means initial margin = $1,000
  • Price rises to $105,000
  • Gross PnL = ($105,000 - $100,000) × 0.1 = $500
ROM = $500 / $1,000 = 50%

See also