Per-Market Leverage
Per-Market leverage introduces market specific leverage limits, giving traders finer control over their positions while improving account safety.
Instead of every position sharing a single account level limit, each perpetual market now defines its own maximum leverage cap.
This allows higher leverage on stable assets and stricter limits on more volatile ones.
How Per-Market Leverage Works
Each perpetual market defines its own maximum leverage through its protocol-set initial margin ratio (margin_ratio_initial), with an additional surcharge (the IMF factor) applied to large positions. This is the most leverage anyone can use in that market.
On top of the market cap, you can optionally hold yourself to a lower limit — either account-wide (account.max_margin_ratio) or per position (position.max_margin_ratio). These overrides can only make your limit more conservative; they can never raise it above the market’s cap.
When evaluating a position, Velocity uses the largest (most conservative) applicable margin ratio — equivalently, the lowest leverage:
effective_margin_ratio = max(
market.margin_ratio_initial, // protocol cap for the market (+ IMF surcharge on large size)
account.max_margin_ratio, // your optional account-wide cap
position.max_margin_ratio // your optional per-position cap
)| Market | Market cap (margin_ratio_initial) | Your optional override | Effective leverage | Result |
|---|---|---|---|---|
| SOL-PERP | 20x (5% margin) | none | 20x | Market cap applies |
| SOL-PERP | 20x (5% margin) | 10x | 10x | Your override is more conservative |
Illustrative. SOL-PERP’s live initial margin ratio is 5% (20x); each market’s current values live on-chain.
A higher margin ratio means lower leverage, so the most conservative limit always wins. From this ratio, the protocol derives the maximum position size you can open with your available collateral and the liquidation threshold for that position.
Risk and Control
Per-market leverage gives traders more flexibility and control:
- Apply different leverage limits for different strategies or market conditions.
- High-risk markets can be capped tightly without restricting more stable ones.
- Each market’s maximum leverage and liquidation threshold are clear and predictable.
Per-market leverage caps do not isolate risk between positions. Unless a position is an isolated position, all of a subaccount’s positions share one pool of collateral and one maintenance-margin requirement — a large loss on one market (say HYPE-PERP) still draws down the collateral backing your other positions (say BTC-PERP) and can contribute to a cross-margin liquidation. To fully segregate a position’s collateral and liquidation, use an isolated position.
Code Implementation
Files and functions
Per-market leverage logic is implemented in:
state/user.rsstoresmax_margin_ratioon thePerpPositionstructVelocityClient.updateUserPerpPositionCustomMarginRatio(@velocity-exchange/sdk,velocityClient.ts) updates per-position settings