TIP 2: Perpetuals
Perpetual contracts (perps) are the core derivative instrument: a position in a synthetic contract that tracks an underlying via the mark and oracle prices, held with leverage and kept anchored to the oracle price by periodic funding.
Model
- Trades settle on the perp sub-account as positions, not balance swaps.
- A fill updates the position's size and average entry price and books realized PnL on reduction. Funding continues to accrue against the open size and settles on the funding cycle. See Clearing & Settlement.
- Positions are valued continuously against the mark price; unrealized PnL feeds the margin/health calculation in the Margin System.
Entry price & PnL
Entry price
The entry price is the volume-weighted average price at which the current position was opened or added to:
Entry Price = ∑(Fill Price × Fill Size) ÷ Total Position SizeHow it changes per action:
| Action | Effect on entry price |
|---|---|
| Open position | Set to the fill price |
| Add in the same direction | Recalculated as the weighted average of old and new fills |
| Reduce (partial close) | Unchanged — only realized PnL is booked |
| Flip direction | The old side closes; the residual opens a new position at the crossing fill price |
Entry price resets to zero once the position is fully closed.
Unrealized PnL
Open positions are marked continuously against the mark price:
- Long —
Unrealized PnL = (Mark Price − Entry Price) × Position Size - Short —
Unrealized PnL = (Entry Price − Mark Price) × Position Size
Unrealized PnL feeds the margin/health calculation in the Margin System.
Realized PnL
Realized PnL is booked when a position is reduced or closed, at the exit fill price:
- Long —
Realized PnL = (Exit Price − Entry Price) × Closed Size - Short —
Realized PnL = (Entry Price − Exit Price) × Closed Size
Net of costs: Net PnL = Realized PnL − Trading Fees − Funding Paid. See Clearing & Settlement for how these settle into the account, or Entry Price & PnL for a trader-facing walkthrough with worked examples.
Contract types
Perpetuals can be configured as:
| Type | Name | Margin / PnL denominated in |
|---|---|---|
| Linear | USD-margined | quote asset (e.g. USDC) |
| Inverse | coin-margined | base asset |
The contract style is set per market in its instrument configuration. Read currencyType from perpMeta to see which currency a market margins and settles in, rather than assuming one style across all markets.
Margin & leverage
Perps are the instrument type that uses the full margin system:
- Margin modes — Cross or Isolated (a market may be configured as isolated-only).
- Position modes — One-Way or Hedge.
- Tiered margin — maintenance margin rate and max leverage scale with position size.
All formulas and tier semantics are in Margin System.
Funding
Perpetuals settle funding on a fixed cycle (protocol default 1 hour; the interval is a network parameter and can be configured) to anchor the contract price to the oracle price. Funding is accrued per position and books into margin (isolated) or account equity (cross). See Risk Engine § Funding.
Perp-specific order behavior
On top of the shared order model:
- Reduce-only — orders that may only reduce an existing position, never open or increase one.
- Trigger orders (TP/SL) — stored separately and activated into the book when the mark price crosses the trigger price.
- TWAP — large orders sliced across blocks to reduce impact.
Config
Perps use the common instrument settings, with type set to perpetual and the contract style (linear / inverse) selected. Margin tiers are configured per market through governance. Open interest may be capped via the oracle, and order prices are bounded by the oracle's price limits.