Free lesson · Crypto derivatives
Equity versus maintenance along a price path
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Liquidation risk is about the account’s marked equity compared with its required maintenance at each checkpoint.
Symbols, units & horizon
- E_t: account equity USD at checkpoint t
- E_0: initial cash USD
- q: signed base units
- P_t,P_0: mark and entry USD/base
- F_t: cumulative signed funding USD
- C_t: cumulative fees USD
- m: maintenance fraction
- M_t: required maintenance USD
When and why to use this
Replay a basis hedge across separate margin accounts before treating terminal convergence as attainable.
Liquidation risk is about the account’s marked equity compared with its required maintenance at each checkpoint.
For a simple isolated linear position, equity is initial cash plus marked P&L plus signed funding less fees. Maintenance can be modeled as a fraction of current absolute notional.
Check the path before evaluating the terminal hedge. Real systems may include tiered maintenance, insurance fees, partial liquidation and portfolio margin; the toy threshold is not a venue liquidation quote.
Equity versus maintenance along a price path
- Mark the position with signed quantity times price change.
- Add funding received and subtract fees to update equity.
- Compute current notional times maintenance fraction and compare equity against it.
Long q=.2 BTC, entry $50,000, cash $1,000, mark $46,000, funding −$20, fees $10: equity=1000−800−20−10=$170. Maintenance at .02 is $184, so the simplified threshold is breached.
Apply it in a strategy
- Replay a basis hedge across separate margin accounts before treating terminal convergence as attainable.
- Record the input timestamp, executable quantity, currency and horizon. Reconcile the result with a cash-flow or state table.
- Stress this failure condition: Mark/index mechanics and maintenance tiers differ by venue; a synthetic threshold cannot be used as a live liquidation calculator.
Research deliverable
Build and explain a equity versus maintenance along a price path worksheet. Replay a basis hedge across separate margin accounts before treating terminal convergence as attainable.
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 margin_check(cash,q,entry,mark,funding,fees,maintenance):
if min(cash,entry,mark,fees)<0 or not 0<=maintenance<1: raise ValueError("Invalid margin inputs")
equity=cash+q*(mark-entry)+funding-fees
requirement=maintenance*abs(q)*mark
return equity,requirement,equity<=requirement
print(margin_check(1000,.2,50000,46000,-20,10,.02))Continue learning
Crypto Derivatives: Carry, Funding and Liquidation — all lessons- Linear contract payoff and the multiplier
- Inverse contracts pay in the base asset
- Basis annualization and its limits
- Perpetual funding as actual cash flows
- Equity versus maintenance along a price path
- Solve a simplified liquidation boundary
- Collateral depegs and wrong-way exposure
- Reconcile the funded spot–perpetual hedge
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations