Trading Dev AcademyFree quant education

Free lesson · Crypto derivatives

Solve a simplified liquidation boundary

Open interactive lessonPractice calculationsExplore labs

Start with the idea

Solving the equity-maintenance equality helps explain why higher leverage leaves a smaller price buffer.

Symbols, units & horizon
  • P_liq: simplified long-position liquidation mark USD/base
  • q: positive base units long
  • P_0: entry USD/base
  • E_0: initial isolated cash USD
  • m: constant maintenance fraction between 0 and 1
  • funding/fees zero in this derivation

When and why to use this

Explain leverage sensitivity and compare simplified stress buffers before adding a venue-specific margin engine.

Solving the equity-maintenance equality helps explain why higher leverage leaves a smaller price buffer.

For a long linear isolated position with no funding or fees and constant maintenance fraction, equate cash plus marked P&L to required maintenance. This produces a threshold useful for sensitivity analysis.

The equation gives a checkpoint under ideal continuous marking, not the final executed liquidation price. Gaps, liquidation charges and inability to replenish collateral can worsen outcomes.

Pliq=qP0−E0q(1−m)
Algebraic boundary under an isolated linear margin model

Solve a simplified liquidation boundary

  1. Set E_0+q(P−P_0)=mqP.
  2. Collect qP(1−m)=qP_0−E_0.
  3. Divide by q(1−m); if numerator is nonpositive, no positive-price boundary exists under this toy model.
Work it by hand

q=.2 BTC, entry $50,000, cash $1,000, m=.02: threshold=(10000−1000)/(.2×.98)≈$45,918.37/BTC.

Apply it in a strategy

  • Explain leverage sensitivity and compare simplified stress buffers before adding a venue-specific margin engine.
  • Record the input timestamp, executable quantity, currency and horizon. Reconcile the result with a cash-flow or state table.
  • Stress this failure condition: Cross margin, fees, tier changes and collateral haircuts require a different boundary.

Research deliverable

Build and explain a solve a simplified liquidation boundary worksheet. Explain leverage sensitivity and compare simplified stress buffers before adding a venue-specific margin engine.

Evidence boundary: Synthetic arithmetic and scenarios illustrate mechanics. They are not historical returns, a paper replication, or evidence of an executable edge. Research sources and their access limitations are recorded at the end of this module.

Python implementation

Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.

# Python 3.10+; standard library unless NumPy is imported below.
# Inputs and outputs use the units defined in this lesson. Synthetic teaching example.
def long_liquidation(q,entry,cash,maintenance):
    if q<=0 or entry<=0 or cash<0 or not 0<=maintenance<1: raise ValueError("Invalid isolated-long inputs")
    return max(0,(q*entry-cash)/(q*(1-maintenance)))

print(long_liquidation(.2,50000,1000,.02))

Continue learning

Crypto Derivatives: Carry, Funding and Liquidation — all lessons
  1. Linear contract payoff and the multiplier
  2. Inverse contracts pay in the base asset
  3. Basis annualization and its limits
  4. Perpetual funding as actual cash flows
  5. Equity versus maintenance along a price path
  6. Solve a simplified liquidation boundary
  7. Collateral depegs and wrong-way exposure
  8. Reconcile the funded spot–perpetual hedge

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations