How PnL is realized
PnL becomes realized in two different ways.
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.
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.Relationship to other balance changes
PnL settlement is one of several ways a strategy balance can change.
When a settlement cycle contains both periodic PnL settlement and funding, PnL settlement happens first and funding follows.