Docs
v1.0
DOCS / §02

Trading

Open leveraged long or short positions on an event's probability. Margin, mark price, funding, and PnL are computed continuously; settlement is written on-chain.

Collateral & balance

All positions are margined in USDC held in the on-chain CollateralVault. Your balance is split into buckets, mirrored in HotCache for fast reads:

available
Free balance you can use for new orders or withdraw.
locked_for_orders
Initial margin reserved by resting orders not yet filled.
locked_for_positions
Margin backing open positions.
locked_for_withdraw
Amount pending the on-chain withdrawal delay.

Deposits are direct on-chain transfers to the vault. Withdrawals pass through a delay window — the protocol can reject a withdrawal during that window if your equity would fall below requirements, which is what makes off-chain margining safe.

Margin

perp.com uses cross-style margining per market with two thresholds:

  • Initial margin (IM) — required to open or increase a position. Charged up front and held in locked_for_positions.
  • Maintenance margin (MM) — the floor your equity must stay above. Cross it and the position becomes liquidatable.

Open-interest-scaled initial margin

The initial margin factor is not flat. It scales with the market's open interest between a per-market lower and upper cap: below the lower cap you pay the base factor; above the upper cap you pay the maximum. The crowdedness of a market raises the cost of adding to it, which damps reflexive blow-offs in thin event markets.

Effect Two identical orders can require different margin depending on how much open interest already sits in that market. Your client sees the effective requirement returned at order time.

Equity & PnL

Equity is your position margin plus unrealized PnL plus accrued funding. Unrealized PnL is marked against the mark price — the guarded probability — not the last trade, so a single thin print can't trigger or dodge a liquidation.

Mark price

The mark is the smoothed, guarded probability the protocol reads from its oracle. It drives margin, PnL, and liquidation. It is distinct from the trading price set by the order book. The full guard pipeline — deviation clamp, smoothing, staleness, bounds — is documented on the Oracle page.

Funding

Funding is the mechanism that keeps the trading price anchored to the mark. When the book trades persistently above the mark, longs pay shorts; when it trades below, shorts pay longs. It is computed in three stages:

  1. Per-block premium sample. The engine sweeps a fixed notional through each side of the book to get an impact-bid and impact-ask, takes the impact-mid, and subtracts the index. The result is clamped to a per-market bound.
  2. Per-minute median. Block samples are reduced to a median each minute, rejecting momentary book gaps.
  3. Per-period average. Minute medians are averaged across the funding interval to produce the period's funding rate.

The rate is capped so a single period can never push a fully-margined position past maintenance. The cumulative funding index delta is pushed on-chain via applyFundingIndex, and your position accrues funding lazily the next time it's touched — a fill, a liquidation, or settlement.

Interval
8h baseline, scaled per market — shorter for sub-day events, longer for multi-day events.
Basis
Impact-mid versus index, in probability points (absolute, not relative).
Cap
Bounded by a factor of the margin buffer so funding alone can't force a liquidation.

Market lifecycle

A market moves through an explicit on-chain state machine. Trading behavior changes at each phase:

PhaseTradingNotes
ActiveFullOpen, close, increase, decrease. Funding and liquidation run.
Resolving / SettlingReduce-onlyThe mark interpolates from its last value toward the resolved value over a window. No new exposure.
Resolved → SettledClosedResidual positions close at the oracle terminal value; balances are released.

During the settling window the SETTLING Handler interpolates the mark and enforces reduce-only so positions land gently rather than gapping to 0 or 1 at the instant of resolution.

Fees

Taker fills pay a fee; resting maker liquidity is rebated or charged less, encouraging book depth. A share of fees and liquidation residuals seeds the Insurance Fund.