How It Works
When a trader calls early termination, the position is settled immediately using the live forward price rather than waiting for the fixing price at maturity. The settlement mechanics (PnL computation, fee collection, USDC distribution) follow the same internal flow as maturity settlement, but with a different price source. Function:SettlementEngine.closePosition(uint256 positionId)
CloseReason: EARLY_TERMINATION
Preconditions
Three conditions must be met for early termination:| Condition | Error on Failure |
|---|---|
Position status is OPEN | PositionNotOpen |
Position is not liquidatable (equity >= MM threshold) | EarlyTerminationNotAllowed |
| Caller is the position owner | NotPositionOwner |
Termination Flow
Owner Calls closePosition
The position owner submits a transaction to
SettlementEngine.closePosition(positionId). Only the owner can initiate early termination — unlike settlement and liquidation, this is not a permissionless operation.Validate Preconditions
The contract verifies the position is OPEN, the caller is the owner, and the position is not liquidatable. The liquidation check fetches the current forward price and computes equity.
Get Forward Price
The current forward price for the position’s fixing timestamp is fetched via
OracleModule.getForward(pairId, fixingTimestamp). An oracle fee is collected from the trader’s collateral.Compute PnL
PnL is computed against the forward price:
- LONG:
pnl = notional * (forwardPrice - entryStrike) / PRICE_PRECISION - SHORT:
pnl = notional * (entryStrike - forwardPrice) / PRICE_PRECISION
realizedPnl (capped at margin) and marketPnl (uncapped) are recorded.Collect Fee
The trading fee is calculated using the snapshotted rate:No liquidation penalty is applied. The fee is capped at available margin after PnL settlement.
Why Close Early?
Lock In Profits
If the forward price has moved in your favor, close early to realize the gain instead of risking a reversal before maturity.
Cut Losses
If the position is losing value but not yet liquidatable, close early to preserve remaining margin rather than waiting for a potential further decline.
Free Up Margin
Closing a position unlocks the margin, making it available as free collateral for new positions or withdrawal.
Forward Price vs Fixing Price
The key difference between early termination and maturity settlement is the price used:- Early Termination Price
- Maturity Settlement Price
Uses the live forward price for the position’s fixing timestamp. The forward price is published by the authorized publisher and includes time-value adjustments based on the interest rate differential. As the position approaches maturity, the forward price converges toward the spot price, but until maturity it may include a premium or discount reflecting the time remaining.The forward price can be fetched at any time and changes with every publisher update cycle (approximately every 30 seconds).
Because the forward price includes a time-value component, early termination may result in a slightly different outcome than what maturity settlement would have yielded. For short-duration positions close to maturity, the difference is typically small. For longer-duration positions terminated well before maturity, the forward premium or discount can be more significant.
Fee Comparison
Early termination charges only the standard trading fee. There is no liquidation penalty:| Close Path | Trading Fee | Liquidation Penalty | Total |
|---|---|---|---|
| Early Termination | notional * snapshotTradingFeeBps / 10000 | None | Trading fee only |
| Maturity Settlement | notional * snapshotTradingFeeBps / 10000 | None | Trading fee only |
| Liquidation | notional * snapshotTradingFeeBps / 10000 | notional * snapshotLiquidationPenaltyBps / 10000 | Both fees combined |
Mode Restrictions
Early termination is allowed in NORMAL, DEGRADED, and REDUCE_ONLY modes. It is only blocked in PAUSED mode. This is intentional — even when the protocol restricts new position openings (DEGRADED, REDUCE_ONLY), traders can still close their existing positions to manage risk.| Mode | Early Termination |
|---|---|
| NORMAL | Allowed |
| DEGRADED | Allowed |
| REDUCE_ONLY | Allowed |
| PAUSED | Blocked |