Entry price and PnL
The display of Entry Price and Profit & Loss (PnL) on SoDEX serves as a crucial user-interface layer, while the underlying accounting is anchored in the user's margin balance and trade history.
Perpetual Contract (Perp) Definitions
Opening Trade
Any trade that increases the absolute size of an existing position (e.g., buying more Long, selling more Short).
Increases the absolute size.
Closing Trade
Any trade that reduces the absolute size of an existing position (e.g., selling a Long position, buying back a Short position).
Decreases the absolute size.
Entry Price Calculation
For Opening Trades: The Entry Price is recalculated using a weighted average of the previous entry price and the price of the new trade, based on their respective notional sizes.
For Closing Trades: The Entry Price of the remaining open position remains unchanged.
PnL Formulas
Unrealized PnL (Open Positions)
This reflects the potential PnL of the open position, based on the current Mark Price.
side = 1 for a Long position; side = -1 for a Short position.
Closed PnL (Realized)
This represents the actual PnL realized from a trade:
For a Closing Trade: The PnL includes the actual profit/loss from the closed portion, plus fees:
For an Opening Trade: The Closed PnL consists only of the fees paid for that trade (as no profit is realized until the position is closed).
Spot Market Distinctions
The fundamental PnL and Entry Price formulas are applied to the Spot Market with the following accounting conventions:
Buys are treated as Opening Trades.
Sells are treated as Closing Trades.
Wallet transfers of assets (for accounting purposes) are treated as virtual buys or sells at the current Mark Price.
Last updated