Stroby LogoStrobe Docs

2. Solvency

Margin ratios determine the health and safety of positions in Perp City markets, defining when positions become eligible for liquidation. Each market configures thresholds that balance risk tolerance with capital efficiency, protecting the protocol from bad debt while enabling leveraged trading.

Margin and Position Health

A position's margin ratio represents its level of collateralization and, by extension, its risk. It measures how much margin a position holds relative to its total exposure (or notional value).

Let margin\mathsf{margin} be a position's collateral after accounting for PnL, funding, and fees. Further, let notional\mathsf{notional} represent the total value of a position's assets. For makers, this is the sum of both accounting tokens; for takers, this is the value of the position's perp accounting tokens. Then, margin ratio, rmr_m, is defined as:

rm=marginnotionalr_m = \frac{\mathsf{margin}}{\mathsf{notional}}

Notice that rmr_m is the inverse of current leverage. There are three conditions:

  1. margin=notional    rm=1,leverage=1×\mathsf{margin} = \mathsf{notional} \implies r_m = 1,\: \mathsf{leverage} = 1\times
  2. margin<notional    rm<1,leverage>1×\mathsf{margin} < \mathsf{notional} \implies r_m < 1,\: \mathsf{leverage} > 1\times
  3. margin>notional    rm>1,leverage<1×\mathsf{margin} > \mathsf{notional} \implies r_m > 1,\: \mathsf{leverage} < 1\times

That is, the position is either under-leveraged or over-collateralized. As rmr_m increases the position becomes safer; as rmr_m decreases, the position becomes riskier. Collateral can be added to a position to increase rmr_m and consequently its safety. On the other hand, however, collateral cannot be removed from a position.

Parameterization

Each perp market specifies a Margin Ratio Module. This module defines:

  • Minimum opening margin ratio
  • Maximum opening margin ratio
  • Liquidation threshold

All parameters are defined separately for makers and takers. Once a position is opened, its corresponding liquidation threshold is immutable. A position cannot be liquidated later because the global threshold changed.

Modules can expose dynamic functions, allowing margin ratio requirements to evolve as the market matures. For example, as liquidity deepens, maximum allowed leverage can gradually increase. Different modules may also suit different index types: stable indexes can support higher leverage, while volatile ones require more conservative thresholds. Currently, the only supported margin ratio module exposes a static set of ratios for makers and takers.

Liquidations

Every market specifies a liquidation margin ratio threshold rmr_{m}^{*} that defines when a position becomes dangerously undercollateralized and can be liquidated. Ideally, liquidation occurs before the position's losses exceed its posted margin. When a liquidation occurs, the position is closed with a fee that is sent to the caller, and the remaining margin is sent back to the holder. If liquidation lags and the losses surpass the margin, bad debt is created, requiring further recovery mechanisms.

We are currently running an internal liquidation bot, which is open-sourced here. From our testing, it is able to process 3,000 liquidations per block. The purpose of liquidation fees is to incentivize others to build more performant liquidators and keep markets healthy. See: Liquidation Fees.

ADL

When a position loses more value (through PnL, funding, or fees) than its remaining margin, the system records bad debt, meaning another participant's expected gains cannot be paid. In this case, the protocol socializes the loss across all open taker positions, weighted by their notional exposure. Makers are not subject to ADL. In the future, we have plans to support more sophisticated implementations of ADL based on trading feedback.

Example

Consider a taker who opens a position with $50 margin to buy 2 perps, each priced at $50. Then the notional value of the position is $100 and rm=0.5r_m = 0.5 at entry (equivalent to 2×2\times leverage).

Now, assume the perp price drops to $40. Since the position holds 2 perps, each losing $10 in value, the position incurs –$20 PnL. We therefore have $30 worth of margin and a notional position value of $80, resulting in a rm=0.375r_m = 0.375 (or 2.67×2.67\times leverage). If the market is risk-intolerant and enforces a liquidation threshold of rm=0.4r_m = 0.4, the position is now liquidatable.