How PnL is realized
PnL becomes realized in two different ways.| Path | When it happens | What changes |
|---|---|---|
| Trade-fill realization | When a fill closes or reduces exposure | The fill realizes trade PnL immediately into strategy collateral |
| Periodic PnL settlement | At the periodic settlement boundary | The remaining unrealized PnL on each open position is realized into strategy collateral |
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.| Effect | Result |
|---|---|
| Unrealized gain | Credited to strategy collateral in USDC |
| Unrealized loss | Debited from strategy collateral in USDC |
| Average entry price | Reset to the settlement mark price |
| Position size | Unchanged |
| Position side | Unchanged |
Timing
Periodic PnL settlement runs on its own cadence inside the broader settlement-epoch schedule.| Parameter | Value | Notes |
|---|---|---|
| PnL settlement cadence | Every 24 hours | The public baseline realizes open-position PnL once every three 8-hour settlement epochs |
| Price input | Mark price | The same fair-risk price used for margin and liquidation |
| Balance updated | Strategy collateral | The result is a STRATEGY_UPDATE with reason PnlSettlement |
| Markets covered | Perpetual swaps | The 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 change | Event reason | Notes |
|---|---|---|
| Deposit or withdrawal | Deposit, Withdraw, WithdrawIntent | On-chain collateral movements |
| Trade fill | Trade | Fill-time realized PnL and non-DDX fees |
| Periodic PnL settlement | PnlSettlement | Realizes remaining unrealized PnL on open positions |
| Funding | FundingPayment | Periodic transfer between longs and shorts |
| Fees in collateral currency | Fee | Charged in USDC when fees are not paid in DDX |
Worked settlement cases
These examples show the periodic settlement step for one open position.| Position before settlement | Settlement mark | Periodic settlement result |
|---|---|---|
Long 1 ETHP with average entry 2,000 | 2,050 | +50 USDC realized to collateral; average entry resets to 2,050 |
Long 1 ETHP with average entry 2,000 | 1,950 | -50 USDC realized to collateral; average entry resets to 1,950 |
Short 2 ETHP with average entry 2,000 | 1,980 | +40 USDC realized to collateral; average entry resets to 1,980 |