OriginDOCS

Margining & Risk

Margin Modes

Cross Margin (default)

In cross-margin mode, all positions in an account share the entire collateral pool. Unrealized PnL on profitable positions offsets margin requirements on losing positions, maximizing capital efficiency. Cross margin is recommended for users running diversified or hedged portfolios.

Isolated Margin

In isolated mode, the user allocates a specific amount of collateral to a single position. Losses on that position cannot exceed the allocated margin, and gains do not increase the buffer for other positions. Isolated margin is useful for high-conviction directional trades or for ring-fencing risk on individual strategies.

Margin Requirements & Leverage Tiers

Initial and Maintenance Margin

  • Initial Margin (IM). Collateral required to open or increase a position.
  • Maintenance Margin (MM). Minimum collateral required to keep a position open. Falling below MM triggers liquidation.

Both are expressed as a percentage of position notional and are tied to the leverage tier of the market.

Leverage Tiers

TierMarketsMax LeverageInitial MarginMaintenance Margin
MajorsBTC, ETH, top equity indices20x5.0%2.5%
MidMajor altcoins, single-name equities, major commodities10x10.0%5.0%
LongtailLower-liquidity perps3x33.3%16.7%
RWA-perpsTokenized real-world asset perps10x10.0%5.0%

Position Tier Decay

Maximum leverage decays with position size. Each market publishes a tier ladder where the first tranche of notional uses the headline leverage and successive tranches require higher initial and maintenance margin. This protects the system from concentration risk.

Example tier ladder for BTC-PERP (illustrative; see live parameters for current values):

Notional TrancheMax LeverageIMMM
$0 to $5M20x5.00%2.50%
$5M to $20M15x6.67%3.33%
$20M to $50M10x10.00%5.00%
$50M+5x20.00%10.00%

Effective IM and MM for an account are computed by integrating position size across the tranches it occupies. The aggregate initial_margin_required and maintenance_margin_required are the sum of the per-tranche contributions.

Margin Ratio

Margin ratio is the central solvency metric:

margin_ratio = account_equity / maintenance_margin_required

account_equity                = collateral_value_usd + Σ unrealized_pnl_i
maintenance_margin_required   = Σ_i ( position_notional_i × mm_rate_i )

A margin ratio at or above 1.0 means the account is solvent at maintenance level. Below 1.0 triggers liquidation.

Worked Example: Cross-Margin Solvency

Account state:

  • Collateral: 100,000 USDC (haircut 0%) and 1 BTC at $80,000 oracle price (haircut 15%).
  • Open position: long 5 BTC-PERP at average entry $75,000, mark price $78,000.
  • Tier: Majors. IM 5%, MM 2.5%.
collateral_value_usd      = 100,000 + ( 1 × 80,000 × 0.85 )
                          = 168,000

unrealized_pnl_usd        = 5 × ( 78,000 - 75,000 )
                          = 15,000

account_equity            = 168,000 + 15,000
                          = 183,000

position_notional         = 5 × 78,000
                          = 390,000

initial_margin_required   = 390,000 × 0.050     = 19,500
maintenance_margin_required = 390,000 × 0.025   = 9,750

margin_ratio              = 183,000 / 9,750
                          ≈ 18.77

health_state              = HEALTHY              (183,000 ≥ 19,500)

The account is well above maintenance level. It would transition to AT_RISK when account_equity falls to 19,500 (initial margin required), and to LIQUIDATABLE when it falls below 9,750 (maintenance margin required), both of which would require substantial adverse moves.

Account Health States

Origin classifies each account into one of three health states based on the relationship between account equity and the two margin thresholds. The state determines what operations are permitted.

StateConditionPermitted Operations
HEALTHYaccount_equity ≥ initial_margin_requiredAll operations: open new positions, increase existing positions, place new orders, withdraw free collateral.
AT_RISKmaintenance_margin_required ≤ account_equity < initial_margin_requiredOnly operations that improve account health: reduce position size, close positions, deposit additional collateral. New orders that would increase position size are rejected. Withdrawals are blocked.
LIQUIDATABLEaccount_equity < maintenance_margin_requiredNone for the user. The Liquidation Engine takes control (Section 7.4). User-submitted orders are rejected.

Formal AT_RISK Constraint

For any operation that would change the account's positions or margin, the operation is permitted in AT_RISK only if both of the following hold:

∀ markets i:    |position_new_i| ≤ |position_old_i|

                account_equity_new          account_equity_old
                ──────────────────────  ≥   ──────────────────────
                initial_margin_req_new      initial_margin_req_old

The first condition prevents adding to any position. The second prevents the operation from worsening overall margin posture.

Continuous Re-Evaluation

The Risk Engine re-evaluates account health on every mark-price update, every fill, and on a 500ms heartbeat (Section 7.4.1). State transitions across thresholds are emitted to the user over the private WebSocket stream as soon as they occur.

Liquidations

Solvency Evaluation

The Risk Engine continuously evaluates each account's margin ratio (Section 7.2.4) and health state (Section 7.3). A health state of LIQUIDATABLE (margin ratio below 1.0) flags the account for liquidation.

Margin ratios are evaluated:

  • On every mark price update.
  • On every fill that affects the account's position or balance.
  • At minimum on a 500ms heartbeat.

This ensures liquidation detection is effectively real-time and bounded even if no events occur.

Partial Liquidation Mechanism

Origin uses partial liquidations rather than full closeouts. When an account enters LIQUIDATABLE, the engine first cancels all of the account's open orders to release Order Margin. It then closes only enough of the riskiest position(s) to restore the account's margin ratio above maintenance, targeting the midpoint between MM and IM.

The engine ranks open positions by their contribution to portfolio risk and liquidates the highest-contribution position first. For accounts with a single open position, partial liquidation reduces position size proportionally.

Closeout Pricing

Liquidation orders are submitted as IOC orders with the bankruptcy price (Section 7.4.4) as the permissive limit: a sell-side liquidation will fill at any price at or above bankruptcy; a buy-side liquidation at any price at or below. In normal conditions fills land near mark price, well above bankruptcy, and the account retains residual equity above maintenance. In fast or thin markets fills can land closer to bankruptcy. Origin charges no explicit liquidation penalty: the account pays only the unavoidable cost of being a forced taker at the price the market provides at that instant. Any equity remaining after closeout stays with the account. The natural cost of a forced close (slippage relative to a voluntarily-timed exit) is itself the economic incentive to manage margin proactively.

Bankruptcy Price

The bankruptcy price is the price at which a position's remaining margin reaches zero. For a long:

bankruptcy_price_long = avg_entry_price - ( allocated_margin / position_size )

For a short:

bankruptcy_price_short = avg_entry_price + ( allocated_margin / position_size )

For cross-margin accounts, allocated_margin is the share of the account's collateral attributed to this position; for isolated, it is the explicit allocation. Liquidation closeouts targeting prices worse than bankruptcy create shortfalls absorbed first by the insurance fund (Section 7.5) and finally by ADL (Section 7.6).

Liquidator Network

The internal liquidation engine attempts to fill liquidation orders first, sourcing liquidity from the live order book at or better than the bankruptcy price.

If the internal engine cannot fully fill a liquidation within a short window, the order is exposed to a public keeper network. Any address can register as a keeper. Because there is no liquidation penalty to share, keepers are compensated by a small flat fee per filled liquidation, paid from the insurance fund. The keeper API publishes pending liquidations in real time.

Worked Example: Partial Liquidation Trigger

Account state:

  • Single isolated position: long 10 BTC-PERP, entry $80,000.
  • Allocated margin: $40,000 (5% IM × $800,000 notional at entry).
  • Tier: Majors. IM 5%, MM 2.5%.

Find the mark price at which the account first enters LIQUIDATABLE (margin_ratio = 1):

account_equity        = 40,000 + 10 × ( M - 80,000 )
                      = 10 × M - 760,000

maintenance_margin    = 10 × M × 0.025
                      = 0.25 × M

Set account_equity = maintenance_margin:
    10 × M - 760,000 = 0.25 × M
    9.75 × M         = 760,000
    M                = 77,948.72

Liquidation triggers at mark ≈ $77,949.

At that mark price, the engine:

  1. Cancels any open orders on this account (none in this scenario).
  2. Computes a target margin ratio halfway between MM (margin_ratio = 1.0) and IM (margin_ratio = IM/MM = 2.0), so target margin_ratio = 1.5.
  3. Closes enough position to reach the target. Holding mark price constant, closing at mark converts unrealized PnL to realized with no equity change. To reach margin_ratio = 1.5, the engine reduces position from 10 BTC to approximately 6.67 BTC (closes ~3.33 BTC), leaving the account with restored buffer above maintenance.

If the mark continues falling and the account re-enters LIQUIDATABLE, the engine repeats the process.

Insurance Fund

Purpose

The insurance fund absorbs losses when a liquidated position closes below its bankruptcy price, that is, when adverse price movement exceeds the account's remaining collateral. Without an insurance fund, those losses would socialize across profitable counterparties via ADL.

Funding Sources

The fund is seeded by the protocol at launch. It is sustained by a configurable allocation from trading fees, sized to maintain target capitalization relative to open interest. Keeper fees (Section 7.4.5) are paid out of the fund.

Capitalization Targets

The fund is parameterized with:

  • A target balance expressed as a percentage of total open interest.
  • A floor below which ADL becomes the primary loss-absorption mechanism (Section 7.6.1).
  • A trading-fee allocation rate that increases when balance falls below target.

Live values for each parameter are published in the asset registry.

Transparency

The fund's balance and historical drawdowns are published in real time on the public dashboard and via the insurance fund API. Every inflow and outflow is recorded on-chain.

Auto-Deleveraging (ADL)

Trigger

ADL activates when either:

  1. The insurance fund balance falls below its floor, or
  2. An individual liquidation cannot be filled at or above bankruptcy price even after exposure to the public keeper network.

ADL is a last-resort mechanism, not a routine event.

Counterparty Selection

When ADL triggers, the engine selects counterparty positions on the opposite side of the deleveraged position, ranked by an ADL score:

adl_score = pnl_percentage × effective_leverage

pnl_percentage     = unrealized_pnl / margin_used_for_position
effective_leverage = position_notional / account_equity

Higher-scored accounts are deleveraged first. This ranks the most-profitable, most-leveraged accounts on the opposite side first.

Fill Price

ADL fills execute at the bankruptcy price of the liquidated position. Counterparties subject to ADL therefore close at a price worse than the prevailing mark, but receive the realized PnL implied by that price.

Queue Visibility

Every account with open positions sees its ADL queue rank as a 5-tier indicator (1 = lowest risk of ADL, 5 = highest) for each market via UI and API. The indicator updates in real time as positions and PnL change.

Notifications and Records

ADL events are logged on-chain with the deleveraged accounts, fill price, and quantities. Affected accounts receive immediate notifications via API and UI. Post-event reports are published for material ADL events.