Cross-Margin Mode
All perpetual futures positions on Rails use cross-margin mode. Unrealized profits from one position can support others, but a decline in any position affects the entire account’s health. Account health is measured by the cross-margin ratio:Liquidation
Liquidation is triggered whencrossMarginRatio reaches 100% — meaning your account equity has fallen to exactly the minimum required to hold all open positions.
Liquidation Process
When the threshold is reached:- All open orders are immediately cancelled.
- All positions are closed simultaneously at the best available market price.
- Any remaining funds after covering losses are returned to your balance.
Estimated Liquidation Price
Rails displays a per-position liquidation price estimate. See Position Metrics for the formula. In cross-margin mode this is an estimate that changes dynamically as other positions are opened or closed, index prices move, or funding payments accrue.How to Avoid Liquidation
- Deposit additional funds to increase account equity.
- Reduce position size to lower total maintenance margin.
- Set a stop-loss to automatically close a position before it deteriorates further.
Proactive Order Cancellation
A resting order that fills under deteriorated market conditions can push maintenance margin above account equity instantly. To prevent this, Rails cancels risky orders before they are matched.How It Works
The system computes a simulated cross-margin ratio assuming all qualifying open orders are executed:reduceOnly orders) are never cancelled by this mechanism.
Which Orders Are Included
Only orders that would increase your net position exposure contribute tosimulatedMaintenanceMargin. The system exempts offsetting/closing orders oldest-first up to the current position size; any remaining quantity that would open new exposure is included.
| Order Type | Included in simulation? |
|---|---|
| Increases position size | ✅ Yes |
reduceOnly order | ❌ No |
| Fully offsets existing position | ❌ No |
| Partially increases net exposure | ✅ Excess quantity only |
Thresholds at a Glance
| Ratio | Trigger |
|---|---|
crossMarginRatio ≥ 100% | Liquidation — all positions closed |
simulatedCrossMarginRatio ≥ 90% | Proactive cancellation — risk-increasing orders cancelled |