Skip to main content
DerivaDEX tracks unrealized PnL on open positions continuously, then realizes that PnL into USDC collateral at defined points.

How PnL is realized

PnL becomes realized in two different ways.
PathWhen it happensWhat changes
Trade-fill realizationWhen a fill closes or reduces exposureThe fill realizes trade PnL immediately into strategy collateral
Periodic PnL settlementAt the periodic settlement boundaryThe remaining unrealized PnL on each open position is realized into strategy collateral
Periodic PnL settlement is separate from funding. A settlement cycle can contain both actions, but they are not the same calculation.

Periodic settlement calculation

At periodic settlement, DerivaDEX marks each open position to the current mark price (the fair-risk price used for margin and liquidation), realizes that unrealized PnL into USDC collateral, and resets the position’s average entry price to the settlement mark.
settlement_pnl = unrealized_pnl(mark_price)
new_collateral = old_collateral + settlement_pnl
new_avg_entry_price = mark_price
position_size and side stay the same
EffectResult
Unrealized gainCredited to strategy collateral in USDC
Unrealized lossDebited from strategy collateral in USDC
Average entry priceReset to the settlement mark price
Position sizeUnchanged
Position sideUnchanged
If the unrealized PnL on a position is zero at the settlement mark, the periodic settlement step does not change collateral for that position.

Timing

Periodic PnL settlement runs on its own cadence inside the broader settlement-epoch schedule.
ParameterValueNotes
PnL settlement cadenceEvery 24 hoursThe public baseline realizes open-position PnL once every three 8-hour settlement epochs
Price inputMark priceThe same fair-risk price used for margin and liquidation
Balance updatedStrategy collateralThe result is a STRATEGY_UPDATE with reason PnlSettlement
Markets coveredPerpetual swapsThe public product set does not currently include expiry contracts

Relationship to other balance changes

PnL settlement is one of several ways a strategy balance can change.
Balance changeEvent reasonNotes
Deposit or withdrawalDeposit, Withdraw, WithdrawIntentOn-chain collateral movements
Trade fillTradeFill-time realized PnL and non-DDX fees
Periodic PnL settlementPnlSettlementRealizes remaining unrealized PnL on open positions
FundingFundingPaymentPeriodic transfer between longs and shorts
Fees in collateral currencyFeeCharged in USDC when fees are not paid in DDX
When a settlement cycle contains both periodic PnL settlement and funding, PnL settlement happens first and funding follows.

Worked settlement cases

These examples show the periodic settlement step for one open position.
Position before settlementSettlement markPeriodic settlement result
Long 1 ETHP with average entry 2,0002,050+50 USDC realized to collateral; average entry resets to 2,050
Long 1 ETHP with average entry 2,0001,950-50 USDC realized to collateral; average entry resets to 1,950
Short 2 ETHP with average entry 2,0001,980+40 USDC realized to collateral; average entry resets to 1,980
Last modified on April 24, 2026