Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Margin, Leverage & Liquidation

Learn how leverage and margin modes work, what triggers liquidation, and how Rails protects your capital through a robust risk engine.

The Rails margining system tracks your collateral as you trade, measuring how much you have, how much your positions and orders require to stay open, and how much you have remaining. Leverage determines the margin requirement, and the chosen margin mode (either cross or isolated) determines how that collateral is allocated across open positions.

Users provide collateral for the position’s exposure, representing the total financial risk or market value a trader stands to gain or lose based on the price movement of that specific asset. Rails calculates position-margin requirements using the current mark price, so margin requirements change as the market moves. Open position profits and losses are tracked separately until realized, but unrealized profits can support other positions in cross-margin mode.

Rails also calculates your cross-margin ratio to determine account health and when liquidation is triggered, and is designed to protect your capital during risk management, including proactive order cancellation and staged liquidation for large positions. Liquidation prices for all cross and isolated positions always remain visible, allowing you to easily monitor your exposure, all the way through to potential liquidation, as explained further below.

Leverage

Leverage lets you open a larger position with less upfront collateral. For example, see how leverage changes the maximum position size you can open with $10,000:

Starting Collateral
1x Leverage
2x Leverage
3x Leverage
4x Leverage
5x Leverage

$10,000

$10,000

$20,000

$30,000

$40,000

$50,000

Adjusting the leverage multiplier is available through the order panel, and changing it applies immediately to all positions for that specific market.

Use the leverage drop-down for each market (1x – 5x), as shown to the right.

For an isolated position, increasing leverage lowers the isolated position's required margin, increases excess margin. Excess margin remains in the isolated position unless you explicitly remove it by manually adjusting isolated margin, and therefore your withdrawable balance. Decreasing leverage raises the required margin, reducing the amount available to withdraw.

Margin Modes

Rails offers two margin modes, cross and isolated, which allow you to control how much of your available margin is allocated to each position. Each margin mode operates uniquely, allowing you to remain in control of each of your position's risk by creating margin pools. You have one cross-margin pool, but you can have multiple isolated margin pools — note that the 1 position per market maximum still applies.

Cross Margin Mode (Default)

In cross-margin mode, your cross-margin equity is shared margin across all of your open cross-margin positions. Cross-margin mode is the default for all positions.

Unrealized profit on one position can support another, as unrealized P&L contributes to cross-margin equity. Similarly, a losing position affects the health of your whole cross-margin pool.

Cross margin can help delay or avoid liquidation on an underperforming trade by drawing on your shared cross-margin pool. The tradeoff is that all funds in the pool (and all open cross-positions in the pool) are at risk if the market moves against you. When that happens, your Cross-Margin Ratio reaches 100%, and liquidation is triggered for your cross-margin positions. Isolated positions are not affected.

Your cross-margin equity updates continuously as the mark price changes. Isolated positions are not part of the cross-margin pool.

Isolated Margin Mode

In isolated margin mode, each position has its own separate margin pool that is explicitly created by you.

Because the position is isolated, it cannot draw on any other collateral when the market moves against you. Therefore, its liquidation price is calculated independently based on the position's assigned margin, protecting the rest of your balance from unexpected losses.

Key Differences at a glance

There are some key differences to be aware of when using each margin mode, simplified to show how each mode behaves:

Feature
Cross Margin Mode (Default)
Isolated Margin Mode

Margin Scope

Shared across all open cross-margin positions

Dedicated to a single, isolated position

Liquidation Trigger

Cross-Margin Ratio (CMR) = 100% (Total Cross Maintenance Margin / Cross-Margin Equity)

Position Equity falls below the position's Maintenance Margin

Loss Containment

Account-level; losing positions draw down the shared cross-margin pool

Position-level; losses and risk are strictly contained to that position

PnL Offsetting

Yes; unrealized gains on one position support other cross-margin positions

No; unrealized PnL is completely independent per position

Capital Efficiency

Higher; shared collateral maximizes capital usage across multiple trades

Lower; collateral is segmented into separate position pools

Risk Management

Proactive order cancellation (at or above 90% Simulated CMR) & staged/partial liquidation

Immediate full liquidation of the affected position

Manual Margin Adjustments

Not available

Yes; add or remove margin manually via the order panel/position tab

Liquidation Impact

Liquidation cascade: all cross-margin positions are assessed and at risk together

Isolated impact: only the affected position is closed; other positions are unaffected

Commonly Used For

Multi-position portfolios, hedging, and capital-efficient strategies

High-leverage directional trades, volatile assets, and strict loss-capping

Changing Margin Modes

Margin mode is set per market, and you can only change it when that market has no open position and no open orders. Switching modes changes how your collateral backs a position, so Rails doesn't allow it while a position or order already depends on the current setting.

To change the margin mode, use the drop-down from the order panel, as shown to the right.

Your margin mode only applies to the selected market. Positions and orders in other markets are unaffected, so you can trade one market in cross margin and another in isolated margin at the same time. Read more about margin modes working together.

The positions table in the main UI displays the margin mode per position as shown below, once you've created your positions, as shown to the right.

Manually Adjusting Isolated Margin

Once an isolated position is open, you can add or remove margin to change its risk. Select the pen icon next to the position's margin to open the adjustment modal:

To Increase an Isolated Position's Margin:

The Increase Margin slider is selected by default.

  1. Enter an amount. The window shows how your position margin, account margin, and liquidation price will change.

  2. Select Increase Margin to confirm.

Adding margin lowers the isolated position’s liquidation risk. Added margin comes from your Cross-Margin Balance and cannot exceed your Available Balance. This can leave your cross-margin positions more exposed to liquidation.

To Decrease an Isolated Position's Margin:

  1. Switch to the Decrease Margin tab. It shows the most margin you can remove.

  2. Enter an amount and select Decrease Margin to confirm.

The modal shows your excess margin, which is the most you can remove. You can't remove margin below the minimum the position needs to stay open at its current leverage.

Removing margin moves your liquidation price closer to the mark price, increasing the risk of liquidation.

The margin available to move changes as the market moves. Unrealized losses reduce how much you can remove. Unrealized profits do not increase it. If you select 100% and the market moves against you, lower the amount or select 100% again.

Margin Modes Working Together

Starting with a $10,000 Cross Margin Balance, the example below shows how your cross-margin ratio is impacted when trading across markets using both isolated and cross-margin modes.

This example assumes 1x leverage on the isolated BTC position, 2x leverage on cross positions, no trading fees or funding payments, a 5% maintenance margin rate (MMR) on all positions, and that prices don't move unless a step says so.

Step / Action
Isolated BTC Margin Equity
Cross-Margin Balance
Cross-Margin Equity
Total Cross Maint. Margin
CMR
What changed

Start

$0

$10,000

$10,000

$0

0.00%

No open positions

  1. Open XLM long (Cross, $2,500 position)

$0

$10,000

$10,000

$125

1.25%

$125 = 5% x $2,500

No funds move; your shared balance backs the requirement.

  1. Open BTC long (Isolated, $5,000 position)

$5,000

$5,000

$5,000

$125

2.50%

$5,000 moves from cross to the isolated position. Halving the available cross-margin balance doubles the CMR in this scenario.

  1. Open ETH long (Cross, $4,000 position)

$5,000

$5,000

$5,000

$325

6.50%

$325 = $125 (XLM) + $200 (5% × $4,000 ETH) Both cross positions share the $5,000 balance.

  1. XLM price falls 20% ($500)

$5,000

$5,000

$4,500

$300

~6.7%

XLM’s –$500 unrealized loss reduces cross equity, but your balance is unchanged until the loss is realized. XLM’s requirement drops to $100 (5% × $2,000), but equity falls faster, so CMR rises.

  1. BTC price falls 8% (~$400)

$4,600

$5,000

$4,500

$300

~6.7%

BTC’s –$400 unrealized loss ($5,000 × 8%) is absorbed by its isolated margin. Your cross balance, cross equity, and CMR are unaffected.

  1. Close BTC (-$400 Realized P\&L)

$0

$9,600

$9,100

$300

~3.3%

The remaining $4,600 ($5,000 margin – $400 loss) returns to your cross balance. Cross equity is $9,600 minus XLM’s $500 unrealized loss. Higher equity lowers your CMR.

Key Takeaways:

  1. Moving funds to an isolated position raises your CMR (step 2). Margin assigned to an isolated position leaves your Cross Margin Balance and Cross Margin Equity, so the same cross requirements are backed by less capital.

  2. Unrealized losses on cross positions raise your CMR before anything is realized (step 4). Your Cross Margin Balance doesn’t change until you close, but your Cross Margin Equity does, and equity is what CMR uses. Watch equity, not balance, when judging liquidation risk.

  3. Isolated losses stay isolated (steps 5–6). While an isolated position is open, its losses come only from its own margin, and the most you can lose is the margin you assigned to it. When you close it, whatever remains returns to your Cross Margin Balance.

  4. Cross liquidations can’t draw on isolated margin. If your CMR reaches 100% and triggers a cross liquidation, funds held in isolated positions aren’t used to cover the cross shortfall.

Risk Management

Try our Risk Engine Simulator to see how margin and liquidation work on Rails.

The Rails Risk Engine continuously evaluates your account health in real time to preserve user equity, ensure platform stability, and prevent negative balances. By combining predictive monitoring with automated safeguards, the system intervenes progressively as account risk increases.

Depending on your active margin mode, the platform deploys protective measures in 2 distinct stages:

  1. Early intervention through Proactive Order Cancellation: When your Simulated Cross-Margin Ratio reaches 90%, the risk engine automatically cancels pending orders that would increase exposure. This prevents new trades from executing and immediately placing your account into Liquidation.

  2. Capital Protection through Liquidation: When your account equity is no longer sufficient to back your open positions, the risk engine automatically triggers liquidation based on the margin mode used for those positions:

    1. In Cross Margin: Liquidation triggers when your overall Cross-Margin Ratio reaches 100%. Because your shared cross-margin equity constantly shifts with market prices and funding payments, individual position liquidation prices in cross margin are dynamic estimates that update in real time.

    2. In Isolated Margin: Liquidation triggers when the mark price reaches that position's fixed Liquidation Price, calculated from the margin assigned to that position, making its threshold static and predictable.

Cross-Margin Ratio

Cross-Margin Ratio, or "CMR" for short, is the primary and real-time account health metric. It reflects what is currently happening to your open positions, and determines whether your account is solvent or hitting liquidation by measuring how much of your total cross-margin equity is currently being consumed by required maintenance margin. A low CMR represents a highly healthy account, as your equity is far higher than the minimum margin required to keep positions open. Conversely, a rising CMR means that your maintenance margin requirement is increasing, moving your cross-positions close to liquidation.

When your CMR reaches 100%, you no longer have enough cross equity to support your open positions, and Liquidation is triggered for all cross-margin positions.

Cross Margin Ratio
Account Health

< 100%

Healthy: positions are safe

= 100%

Liquidation process is triggered.

Rails also calculates a Simulated Cross Margin Ratio by assuming all pending orders are filled. While actual CMR triggers liquidation at 100%, Simulated CMR triggers Proactive Order Cancellation at 90% to prevent new orders from pushing you into immediate liquidation. (See Proactive Order Cancellation below for further details).

You can calculate your cross-margin ratio using the formula below:

Cross-Margin Ratio=Total Cross Maintenance MarginCross-Margin Equity\text{Cross-Margin Ratio} = \frac{\text{Total Cross Maintenance Margin}}{\text{Cross-Margin Equity}}

Where:

  • Total Cross Maintenance Margin = SUM(Mark Price × |Position Qty|) × MMR\text {Total Cross Maintenance Margin = SUM(Mark Price × |Position Qty|) × MMR}

  • Cross Margin Equity = Cross Margin Balance + Cross Margin Unrealized PnL\text{Cross Margin Equity = Cross Margin Balance + Cross Margin Unrealized PnL}

  • MMR=Maintenance Margin Rate=5%\text{MMR} = \text{Maintenance Margin Rate} = 5\%

Your CMR is displayed in the account summary panel to the right of your open positions, as shown below:

Example Cross-Margin Ratio Calculation Steps

To calculate the cross-margin ratio from the screenshot above:

  1. Calculate Cross Margin Equity, and subtract isolated margin: 3,975.54−966.87=3,008.673,975.54 - 966.87 = 3,008.67

  2. Calculate Total Cross Maintenance Margin by multiplying the total cross-position value by its maintenance margin rate of 5%: 858.07×5%=42.90858.07 \times 5\% = 42.90

  3. Calculate Cross-Margin Ratio by dividing the required cross maintenance margin by cross margin equity: 858.07×5%3,975.54−966.87=42.90353,008.67≈1.4%\frac{858.07 \times 5\%}{3,975.54 - 966.87} = \frac{42.9035}{3,008.67} \approx 1.4\%

Proactive Order Cancellation

Open orders can increase your liquidation risk if they execute during rapid market drops. To prevent a new trade fill from instantly triggering a liquidation upon entry, the Rails risk engine uses Proactive Order Cancellation. The risk engine calculates a predictive Simulated Cross-Margin Ratio by assuming all eligible pending orders are fully executed. If market movements push your Simulated CMR to 90% or higher, the platform proactively cancels open orders that would increase your net exposure.

Orders that increase net position size are canceled, while reduce-only orders and trades that fully offset or decrease risk are never canceled:

Simulated Cross Margin Ratio
Action

< 90%

No action

≥ 90%

Risk-increasing open orders are cancelled. Canceled Orders stay visible in the canceled order tab for 7 days.

The timeline below illustrates how Proactive Order Cancellation protects an account during a market drop without forcing an immediate liquidation:

Day
Scenario
Detail

T0

A trader holds an open long position with a Cross-Margin Ratio (CMR) of 10% and places a new limit order that increases net position size.

The account has sufficient available balance, so the order is placed successfully, but does not fill.

T1

Market prices drop sharply, pushing the Simulated CMR to 90%, triggering cancellation of the open order.

The trader's actual CMR could be lower (e.g. ~70%), but Simulated CMR treats all open orders as filled.

T2

Prices continue to decline, pushing the trader's actual CMR to approximately 90%.

Why this matters: If the pending order had filled at T1, liquidation would have likely been triggered immediately at this point. While account equity would be unchanged, required maintenance margin would have increased with the larger position size.

T3

Overnight, the market price recovers, and the user’s CMR falls back to 20%.

The trader's position remains active and unliquidated, strictly because the risk-increasing order was proactively canceled.

Simulated Cross-Margin Ratio Formula

To evaluate your account health under potential market shifts, the risk engine models a scenario where all risk-increasing pending orders execute simultaneously.

Simulated Cross-Margin Ratio=Simulated Maintenance MarginSimulated Cross Margin Equity\text{Simulated Cross-Margin Ratio} = \frac {\text{Simulated Maintenance Margin}}{\text{Simulated Cross Margin Equity}}

By evaluating Simulated Cross-Margin Equity and Simulated Maintenance Margin together, the risk engine accounts for both primary risk drivers at once: increasing margin requirements on cross trades and collateral drain from pending isolated orders. If this predictive ratio reaches 90%, the engine automatically cancels the risk-increasing orders, preserving your buffer before a fill can trigger liquidation.

Simulated Maintenance Margin represents the total margin required if all net exposure-increasing open orders were filled:

Simulated Maintenance Margin=Total Cross Maintenance Margin+(Cross Selected Order Value×MMR)\text{Simulated Maintenance Margin} = \text{Total Cross Maintenance Margin} + (\text{Cross Selected Order Value} \times \text{MMR})

Where:

  • Total Cross Maintenance Margin is the baseline maintenance margin required for your existing, active cross positions.

  • Cross Selected Order Value is the combined notional value (|Quantity|×Mark Price\text{|Quantity|}\times \text{Mark Price}) of all open cross-margin orders that would expand your net exposure.

  • MMR (Maintenance Margin Rate) = 5%

Simulated Cross-Margin Equity represents the effective shared collateral remaining after accounting for margin locked by pending isolated orders:

Simulated Cross-Margin Equity=Cross Margin Equity−Isolated Selected Order Margin\text{Simulated Cross-Margin Equity} = \text{Cross Margin Equity} - \text{Isolated Selected Order Margin}

Where:

  • Cross Margin Equity is your real-time cross balance plus unrealized P&L from active cross positions.

  • Isolated Selected Order Margin is the balance that would immediately be ring-fenced away from your shared cross pool if pending isolated-margin orders execute.

Selected Order Value is a selective filter on open orders so that protective or risk-reducing trades are never penalized, as highlighted in the table below:

Included (Risk-Increasing)
Excluded (Risk Reducing)
  1. Open cross-margin orders that increase net position size

  2. Open isolated-margin limit/trigger orders (since they lock collateral from the cross-margin pool)

  3. Partial quantities of open orders where the excess quantity would increase net exposure.

  1. Reduce-Only orders: orders designated strictly to decreasing active position sizes.

  2. Offsetting orders: Orders that would fully close, or flip existing position direction are excluded. (Note: where an order pushes past the position size, the extra quantity is included, see #3 in the Included list.)

Liquidation

Liquidation happens when your account (in cross margin) or your position (in isolated margin) no longer meets its maintenance margin requirement. The liquidation process is executed automatically by the Rails risk engine to manage financial exposure, protect your account from negative balances, and preserve platform stability during adverse market movements.

From real-time CMR monitoring and proactive order cancellations to margin modes and dynamic isolated margin adjustments, Rails gives you complete control and the tools needed to protect your capital and prevent unexpected liquidations.

When the liquidation trigger is reached, the risk engine automatically intervenes to close open positions. Liquidation triggers differ depending on your chosen margin mode:

Margin Mode
Liquidation Trigger

Cross margin

Cross-Margin Ratio reaches 100%

Isolated margin

The isolated position's mark price reaches its liquidation price.

Rails checks liquidation against the mark price. Liquidation fees apply. See Pricing & Fees for details.

Cross-Margin Liquidation Process

Cross-margin liquidation triggers when your cross-margin ratio hits 100%. Position size determines whether a full or partial liquidation occurs. Small positions below the threshold are closed in full. Large positions are closed in 20% stages to prevent severe price slippage and give order book liquidity time to recover, preserving as much of your remaining equity as possible if prices stabilize.

As soon as your cross-margin ratio reaches 100%, the system proceeds through the following steps:

  1. Cancel Orders: All open orders on cross-margin positions are immediately canceled.

  2. Close Positions:

  • Small Positions (below the partial liquidation threshold): Closed in full.

  • Large Positions (at or above threshold): Closed via partial liquidation in stages. Each stage closes 20% of the current position size.

    • After each 20% closure, your cross-margin ratio is recalculated.

      • If it drops below 100%, liquidation stops.

        • If the ratio remains at 100% or higher, the system waits 30 seconds for the order book to replenish before closing the next 20%.

        • If the ratio drops below 100% but returns to 100% within the same 30-second window, Rails closes the entire remaining position immediately.

  1. Return Balance: Any remaining margin after covering losses is credited back to your balance.

Closing 20% of a position lowers the total dollar amount of margin needed to keep the remaining position open, but the 5% maintenance margin rate itself does not change.

Large Position Thresholds

Cross-margin positions at or above these values qualify for partial liquidation:

All markets use the default large-position threshold unless individually stated, and these may change from time to time.

Market
Threshold

Default

25,000 USDT

BTC

37,500 USDT

Isolated Margin Liquidation Process

Isolated margin positions are always closed in full because a position's isolated margin is not shared across positions. Liquidation is triggered when your isolated position equity reaches the maintenance margin required to support your position, identified by the liquidation price shown in the position summary tab.

Because isolated margin is self-contained, the liquidation price is predictable. It changes only when you change that position (e.g. adjusting margin or leverage, or increasing/decreasing size), not when other positions move.

When that happens:

  1. All open orders on the position are immediately cancelled.

  2. The affected isolated position is immediately closed at the best available market price.

  3. Any remaining margin after covering losses is returned to your cross-margin balance.

Liquidation Price

The Liquidation Price is the mark price level at which liquidation may enter automated liquidation. If the liquidation price of your position is less than or equal to zero, no liquidation price is displayed, otherwise the liquidation price for your open positions can be found directly in your positions tab:

The liquidation price is calculated using the following general formula:

Liquidation Price=Mark Price−Side×Available Margin∣Quantity∣×(1−Maintenance Margin Rate×Side)\text{Liquidation Price} = \text{Mark Price} - \frac{\text{Side} \times \text{Available Margin}}{\left|\text{Quantity}\right| \times \left(1 - \text{Maintenance Margin Rate} \times \text{Side}\right)}

Where Available Margin\text{Available Margin} is dependent on Margin Mode Used:

  • In Isolated Margin:

Available Margin=Isolated Position Equity−Maintenance Marginposition\text{Available Margin} = \text{Isolated Position Equity} - \text{Maintenance Margin}_{position}
  • In Cross-Margin:

Available Margin=Cross Margin Equity−Total Cross Maintenance Margin\text{Available Margin} = \text{Cross Margin Equity} - \text{Total Cross Maintenance Margin}

Cross Margin Liquidation Prices are estimates

In cross-margin mode, the liquidation price shown for any individual position is an estimate and will change dynamically because:

For this reason, Cross-Margin Ratio is the more accurate trigger for liquidation price, however each position will show a calculated estimated liquidation price as a guide.

Avoiding Liquidation

Rails provides a comprehensive suite of risk management tools to give you full visibility and control over your capital, and enabling you to actively manage risk and prevent liquidations before they occur. Depending on your trading strategy, use the tools below to maintain your account health:

In Cross-Margin Mode:

  • Monitor Real-Time Account Health: track your Cross-Margin Ratio directly from the account summary panel.

  • Deposit Funds to Boost Equity: Top up your Cross-Margin Balance to instantly increase your Cross-Margin Equity and lower your overall CMR.

  • Reduce Position Exposure: Trim or close open cross positions to lower your Total Cross Maintenance Margin requirement.

  • Use Trigger Orders: Attach stop-loss trigger orders to automatically close positions if market prices move against you.

In Isolated Margin Mode:

  • Manually Adjust Position Margin: Manually adjust margin from the positions tab to transfer excess balance into an isolated position, moving its liquidation price further away from the mark price.

  • Reduce Position Size or Add Margin: Reduce your position size to lower its maintenance margin requirement, or add margin to lower effective leverage and increase the buffer against liquidation.

  • Monitor Static Liquidation Prices: Track fixed, predictable liquidation thresholds in real time directly within your active Positions tab.

  • Use Trigger Orders: Attach stop-loss trigger orders to automatically close positions if market prices move against you.

How does leverage impact liquidation?

The higher leverage you choose, the lower the collateral you need to open a position. Higher leverage amplifies your risk of potential losses, and brings your liquidation price closer to the current mark price, increasing the risk of liquidation - especially in isolated margin mode, where the liquidation price is more predictable.

Adjusting your leverage changes how much of your collateral is available to absorb losses, and how close your liquidation price sits to the current mark price. Higher leverage means a larger position from the same collateral, so each price move has a bigger impact on your equity.

To see how leverage changes your risk profile, consider the below long isolated position using $10,000 in starting collateral when BTC is trading at $100,000, with a 5% Maintenance Margin Rate:

Parameter
1x Leverage (No Leverage)
2x Leverage
5x Leverage

Position Size

0.1 BTC

0.2 BTC

0.5 BTC

Position Value

$10,000

$20,000

$50,000

Maintenance Margin (5%)

$500

$1,000

$2,500

Available Margin

$9,500

$9,000

$7,500

Liquidation Price

None (≤\le $0)

~$52,632

~$84,211

Drop Required for Liquidation

N/A

~47.4% drop

~15.8% drop

Key Takeaways:

  • Without leverage (1x): Your 0.1 BTC position is fully backed by your own collateral. BTC would have to fall to $0 before liquidation, so no liquidation price is shown.

  • With 2x leverage: Doubling your exposure to 0.2 BTC means price moves hit your equity twice as fast. A drop of about 47.4%, to roughly $52,632, triggers liquidation.

  • With 5x leverage: Controlling 0.5 BTC with the same collateral leaves much less room for volatility. A drop of just 15.8%, to roughly $84,211, triggers liquidation.

For this reason, we recommend confirming your estimated liquidation price in the positions tab, regularly monitoring your cross-margin levels for cross-positions (where liquidation prices are estimates), and placing stop-loss orders to prevent unexpected liquidations during periods of high volatility.

How these figures are calculated:

  • Each liquidation price uses the Liquidation Price formula, where Available Margin is your collateral minus the position's maintenance margin.

  • For example, at 2x Leverage, the liquidation price is: $100,000 − ($9,000 ÷ (0.2 × 0.95)) ≈ $52,632.

  • This example above assumes an isolated position (or a single cross position), no fees, and no funding payments.

Last updated

Was this helpful?