Entry Price / PnL


Entry Price & PnL

Entry price and profit/loss (PnL)—both unrealized and closed—are calculated client-side for your convenience and clarity. These numbers help you track trading performance but don’t affect official, on-chain balances. On-chain accounting is determined purely by margin (for perpetuals) or asset balances (for spot), plus settlement of executed trades.


Perpetual Contracts (Perps)

  • Opening a Position: Any trade that increases your position size in the same direction (buying more when already long, or adding to a short) is an opening trade.

  • Closing a Position: Trades reducing your exposure in the opposite direction (selling longs, buying back shorts) are closing trades.

Entry Price Calculation:

  • For opening trades, your entry price updates using a size-weighted average of existing and new trade prices.

  • Closing trades do not affect the entry price.

PnL Formulas:

  • Unrealized PnL:

    Unrealized PnL=side×(mark price−entry price)×position sizeUnrealized PnL=side×(mark price−entry price)×position size

  • Closed PnL:

    Closed PnL=side×(exit price−entry price)×size+feesClosed PnL=side×(exit price−entry price)×size+fees


Spot Trading

Spot calculations use similar logic, with some key tweaks:

  • Buys are opening trades, and sells are closing trades.

  • Internal transfers are recorded at the current mark price and counted as buys or sells.

  • UBTC on Hyperliquid always tracks real BTC held in custody—guaranteeing a true 1:1 peg for accurate balances.

Last updated