Docs/Leverage & Margin

Leverage & Margin

App

What leverage means

Leverage lets you control a larger position than your cash alone would buy. At 10x, every $1 of your own cash backs $10 of stock exposure — so a 1% move in the stock becomes a 10% move in the cash you put up. That amplification is the whole point: gains and losses are multiplied by the leverage ratio.

Leverage cuts both ways

A 10% adverse move on a 10x position wipes out the cash you committed to that trade. At 50x, a 2% adverse move is enough to trigger liquidation. Use higher leverage for short holding periods with tight risk controls — never as a substitute for getting the direction right.

Tier gating

  • Free tier — 1x only. All positions are cash-backed; no margin.
  • Premium tier — leverage from 1x up to 100x (integer values only).
  • Max tier — leverage from 1x up to 100x.

Leverage is picked per-trade, not per-portfolio. You can have a mix of 1x, 5x, and 20x positions in the same portfolio. The order form on web and iOS shows a leverage input whenever your tier supports it.

How the cash ledger moves

When you buy at Nx leverage, your cash balance drops by notional ÷ N — only the margin. At 10x on $1,000 of stock, cash drops by $100, not $1,000. The remaining $900 is an implicit loan from the broker, derived on read from your position row — it's never stored as a separate cash entry.

At 1x, margin equals notional so cash still drops by the full amount — nothing borrowed.

Shorts work differently

Opening a short credits full short proceeds to your cash (you just sold shares you don't own yet), but you owe the shares back — represented as a negative-quantity position. Equity is unchanged at entry because the cash credit and the stock owed cancel out.

Margin posted — the cash you actually spent

Each position tracks margin posted = notional ÷ leverage at the moment of fill. This is the real cash you spent on that trade — the same amount that left your balance.

  • $1,000 notional at 10x → $100 margin posted, $900 borrowed.
  • Reducing the position proportionally releases margin back to cash.
  • Fully closing at a profit returns your margin plus the full P&L.
  • Fully closing at a loss may return less than your margin — and if the loss exceeds the margin, cash goes negative.

Margin posted is the denominator in your effective-leverage display and the anchor for liquidation math.

Effective leverage on a combined position

If you add to an existing position at a different leverage, the combined effective leverage is:

effectiveLeverage = (total entry notional) / (total margin posted)

Example: 1 share of a $400 stock at 1x (posts $400) plus 1 share at 10x (posts $40) gives $800 notional on $440 margin — effective leverage of ≈1.82x. It is not the average of 1x and 10x; leverage is weighted by margin, not by share count.

The displayed leverage reflects the choices you made when opening each fill and does not drift as the price moves. A 1x cash-backed position stays at 1.0x whether the stock is up 50% or down 20%.

How equity is computed

equity = cash + longMarketValue − shortMarketValue − marginLoan

marginLoan = Σ max(0, notional − marginPosted) over all leveraged longs

The margin loan is the sum across your leveraged longs of (notional − margin posted) — exactly the money the broker implicitly lent you on open.

This formula keeps equity honest no matter how much leverage you use. At entry, equity equals the cash you put up. As prices move, equity moves by (price change × share count) on every position — amplified on the leveraged ones because you hold more shares than cash alone would have bought.

Maintenance margin — tiered by leverage

Maintenance margin is the minimum equity that must be held against each position. The rate scales with the leverage you chose when you opened it:

Leverage chosenMaintenance rateAnalogous to
1x – 2x30%Traditional broker margin
3x – 5x10%Lightly levered account
6x – 20x2.5%Prop firm / futures-style
Above 20x0.5%Crypto perpetuals

Your total maintenance requirement is the sum across all positions. If equity falls below that sum, you're in a margin call. A WARNING fires when equity is within ~10% of the total.

Margin call & auto-liquidation

If equity falls below the total maintenance requirement, our margin engine automatically liquidates your positions — largest unrealized loss first — one at a time until you're compliant again.

On each close:

  • The implicit loan portion is repaid from the sale proceeds.
  • Whatever's left (released margin + realized P&L) flows back to cash.
  • A MarginEvent is written with the liquidated order IDs for audit.
  • A WebSocket notification fires so your UI updates instantly.

Liquidations appear in your order history

A liquidated order is tagged with source LIQUIDATION so you can distinguish it from your discretionary trades. You'll also receive a real-time toast notification for every WARNING, CALL, and LIQUIDATION event.

Worked example: a leveraged long

Starting state: $8,000 cash, no positions.

Open 100 shares of AAPL at $200, 10x leverage
notional         = 100 × $200        = $20,000
marginPosted     = $20,000 / 10      = $2,000        (leaves cash)
marginLoan       = $20,000 − $2,000  = $18,000       (implicit)
cash             = $8,000 − $2,000   = $6,000
longMV           = $20,000
equity           = $6,000 + $20,000 − $18,000 = $8,000  ← unchanged

At entry, equity is the same as before — you just converted $2,000 of cash into $2,000 of exposure plus an $18,000 loan.

AAPL rises 1% to $202
longMV           = 100 × $202 = $20,200
equity           = $6,000 + $20,200 − $18,000 = $8,200
gain on margin   = $200 / $2,000 = +10%   ← the leverage amplification
AAPL drops 5% to $190
longMV           = 100 × $190 = $19,000
equity           = $6,000 + $19,000 − $18,000 = $7,000
loss on equity   = 12.5% hit on starting $8,000 equity

Around $172 the monitor triggers liquidation and buys-to-close the position at market. The $17,200 sale proceeds repay the $18,000 loan (cash short by $800) and the margin is wiped out.

Worked example: a short position going bad (no leverage needed)

Leverage isn't the only path to a margin call — pure shorts can trigger one too.

Short 100 TSLA at $250 with $25,000 cash (1x → 30% MMR)
shortProceeds    = 100 × $250 = $25,000   (credits cash)
cash             = $25,000 + $25,000 = $50,000
shortMV          = 100 × $250 = $25,000   (you owe this back)
equity           = $50,000 − $25,000 = $25,000   ← healthy
TSLA rallies to $400
shortMV          = 100 × $400 = $40,000
equity           = $50,000 − $40,000 = $10,000
maintenanceReq   = 30% × $40,000 = $12,000
equity < maint   → margin call → buy-to-cover the short

Buying power

Buying power tells you how much additional notional you could open right now without breaching any constraint. Two ceilings apply simultaneously:

  • Maintenance-bound. Equity must cover the new position's maintenance requirement at your chosen leverage:
    maxExtraNotional = (equity − currentMaintenance) / MMR_at_leverage
  • Cash-bound. The margin posted on the new fill can't exceed your cash on hand:
    maxExtraNotional = cash × leverage

Your displayed buying power is whichever of the two is smaller.

Don't use 100% of buying power

Using all of it puts you one bad tick away from WARNING territory. A conservative guideline is to keep a 20–30% buffer between your open exposure and your max.

Where leverage shows up in the UI

  • Trade modal — a leverage input appears when your tier supports it; warnings show above 10x, danger above 50x.
  • Positions table — a Leverage column appears whenever at least one position is leveraged; closing the last leveraged position hides it again.
  • Order history — a Leverage column with the same show/hide logic, plus a distinct badge on liquidation orders.
  • Portfolio header — Buying Power alongside Cash Balance, plus a margin-health pill (HEALTHY / WARNING / CALL) when leveraged or short.
  • Notifications — real-time toasts for WARNING, CALL, and LIQUIDATION events on both web and iOS.

What we don't model

MongoTrader intentionally skips some real-broker mechanics to keep paper trading simple:

  • No margin interest or borrow fees. Real margin loans accrue daily interest — we don't charge this.
  • No hard-to-borrow lists. Every symbol is shortable at any size.
  • No pattern-day-trader restrictions. You can day-trade freely.
  • No volatility-based margin bumps. House maintenance rates stay flat by leverage band regardless of the symbol.
  • Liquidations during closed markets use the last known price, rather than waiting for the open.
Real leveraged trading is meaningfully more expensive and constrained than it appears here. Treat this experience as a learning tool, not a 1:1 simulation.

For programmatic access to the margin system (equity, buying power, liquidation prices), see the API Documentation for the portfolio and position endpoints.