📝

Draft article

This article is visible to admins and superusers only. Sign in with an authorized account.

← Maqolalarga qaytish
October 8, 2026
5 daqiqa o'qish

Liquidation before recovery: why acceptable drawdown can still break a margin account

Liquidation before recovery: why acceptable drawdown can still break a margin account
#risk management
#margin
#liquidation
#backtesting
#position sizing

A backtest that ignores margin mechanics finishes a synthetic path with a 3% gain. Its largest intraday decline is 8%, within the investor's chosen 10% limit. Yet the account carrying the position is liquidated before the recovery. Both statements can be true: the investor owns enough money overall, but insufficient money is available as collateral where and when it is required.

The missing object is a path of available margin, evaluated until the first breach. A strategy equity curve tells us how a trading rule would perform if it could keep trading. A margin replay asks whether that continuation was possible.

This article adds that check to the Risk & Position Sizing collection. The outcome is a small reproducible experiment and a specification for adding account survival to an existing backtest.

1. Drawdown and the liquidation boundary measure different things

Conceptual illustration of total investor capital and a smaller isolated collateral compartment with its own boundary

Drawdown measures the decline from an equity peak. Its answer depends on the equity series: the whole portfolio, one account, or a strategy reconstructed from completed trades. Those denominators are different. Money outside a margin compartment can make the investor's drawdown look modest without increasing that compartment's capacity to hold a losing position.

Start with a deliberately simple model: one linear long contract, settled in USD, with quantity q>0q>0, entry price P0P_0, eligible cash collateral CtC_t and cumulative costs KtK_t. At the current mark price PtP_t, define:

Et=Ct+q(Pt−P0)−Kt,Mt=mqPt,Bt=Et−Mt.E_t=C_t+q(P_t-P_0)-K_t, \qquad M_t=mqP_t, \qquad B_t=E_t-M_t.

Here EtE_t is the position's equity, MtM_t its maintenance requirement and BtB_t the remaining margin buffer. The maintenance rate mm is constant only in this toy model. Costs must not also be deducted from CtC_t: either accounting convention works, but combining both double-counts them.

Define the stopping event explicitly:

τ=inf⁡{t:Bt≤0}.\tau=\inf\{t:B_t\leq0\}.

Survival to horizon TT means τ>T\tau>T. A recovery after τ\tau does not restore the original position. With several separately margined accounts, apply the condition to each account; summing their buffers can conceal a local failure.

This abstraction needs a venue adapter. Bybit's documented isolated-margin rules, for example, use the mark price, allocate margin independently to each position, and distinguish liquidation procedures by risk tier. Its documentation also warns that the default last-trade candlestick chart can differ from the price used for liquidation. These are reasons to record the exact account mode and price series, not to copy the toy formula into production. Bybit UTA liquidation rules, updated August 7, 2026.

The funding-cost article explains why holding costs matter. Here their timing matters too: a debit changes BtB_t at its booking event, even when the mark price has not moved.

2. A better hedge can consume the margin needed to survive

Conceptual illustration of a hedge balancing market exposure while a borrowing weight tightens the collateral constraint

Atsushi Hane's March 2026 preprint studies borrowing-funded hedges for constant-product liquidity pools. More hedging reduces exposure but raises collateral utilization. Its optimization includes the probability of reaching a liquidation boundary during the holding period. The first-passage calculation uses a moment-matched approximation; the analytical hedge is static and liquidation treatment simplified. Its numerical hedge ratios therefore cannot be adopted as universal limits. Hane, sections 3.5, 5 and 8.2.

Our practical inference is to separate two questions when evaluating a hedge. How does it change the distribution of trading P&L? How does financing it change the set of paths the account can survive? An improvement in the first answer does not establish an improvement in the second.

This also explains why collateral placement belongs in a strategy specification. The same signals and same total investor capital can produce different forced exits if collateral is allocated differently. The cross-exchange funding article already identifies the problem of profits sitting in another account. The additional step here is to model when a transfer actually becomes eligible collateral, and terminate the original position if it arrives too late.

Keep that event separate from ADL. Tarun Chitra's revised February 2026 preprint describes autodeleveraging as loss allocation after liquidation and insurance protection prove insufficient: profitable counterparties can be forcibly reduced. That is a venue-level mechanism, not the same event as this account exhausting its own margin. Chitra, sections 2.2–2.4. An own-margin survival test does not establish protection from ADL.

3. Same daily closes, different ability to hold the position

Conceptual illustration of two paths reaching the same destination, with one interrupted at a collateral gate before recovery

Consider a synthetic investor with 10,000 USD. They allocate 1,200 USD to an isolated position and retain 8,800 USD in a reserve that is not automatically available as margin. They hold a linear long of 100 units entered at 100 USD. Set maintenance to an artificial 5% of current notional, with no fees or funding.

Both price paths have the same daily observations: 100, 101 and 103 USD. Between the opening observation and the first close, the mild path reaches 95 USD; the shock path jumps directly to 92 USD. These are constructed events, not historical market data.

Without liquidation, investor wealth is:

Wt=10,000+100(Pt−100).W_t=10{,}000+100(P_t-100).

Both paths end at 10,300 USD. Their close-only drawdown is zero. With the intraday event included, their drawdowns are 5% and 8%, respectively. Thus even observing the entire synthetic path and accepting an illustrative 10% portfolio drawdown limit would not reject either one.

The margin calculation gives a different result:

At the intraday event Mild path Shock path
Mark price, USD 95 92
Position equity, USD 700 400
Maintenance requirement, USD 475 460
Margin buffer, USD 225 -60
Original position survives Yes No

In this model the boundary price solves C+q(P−P0)=mqPC+q(P-P_0)=mqP:

Pliq=qP0−Cq(1−m)=10,000−1,200100×0.95≈92.631579.P_{\mathrm{liq}}=\frac{qP_0-C}{q(1-m)} =\frac{10{,}000-1{,}200}{100\times0.95} \approx92.631579.

That is a trigger boundary, not a guaranteed execution price. For the experiment, the shock jumps through it and the simulator closes the entire position at the observed 92 USD, without execution costs. The investor retains 9,200 USD and no longer participates in the recovery. A real venue's takeover, fees and execution can produce a different balance.

Now move 300 USD from the reserve into collateral. If the transfer is credited at a separate event before the shock, equity at 92 USD becomes 700 USD, leaving a 240 USD buffer. If credited at the next event after liquidation, it only rearranges the remaining cash. The original position stays closed. Total starting investor capital is unchanged.

The downloadable Python example uses only the standard library and exact decimal arithmetic:

python3 margin-liquidation-path-dependent-risk.py

Its verified results are:

Scenario Liquidated Minimum buffer, USD Final investor wealth, USD
Mild path No 225 10,300
Shock path Yes -60 9,200
Transfer before shock No 240 10,300
Transfer after shock Yes -60 9,200

The script checks these values, conservation of total cash during transfers, liquidation at equality, and the absence of recovery gains after closure. It demonstrates a mechanism; four chosen scenarios do not estimate a liquidation probability.

4. Replay events in the order that changes collateral

Conceptual illustration of a chronological event queue with price, collateral arrival and forced closure as separate events

Subtracting a liquidation penalty from terminal P&L leaves the main error intact if the strategy continues holding the original position. The replay must change its state: reduce quantity, realize the executed portion, update cash and recalculate requirements before evaluating later signals.

A practical event record should contain a timestamp, account identifier, price source, positions, eligible collateral, maintenance requirement and the reason for each cash movement. Separate a requested transfer from a credited transfer. Separate a trigger from an executed liquidation. Those distinctions allow an unexpected forced exit to be reconstructed instead of explained after the fact with a convenient price chart.

For a real account, the following is a proposed implementation checklist:

  1. Apply price and collateral valuation updates according to the venue's documented sequence.
  2. Book funding, interest and fees at their actual event times.
  3. Credit only confirmed transfers; keep unavailable cash outside eligible collateral.
  4. Recompute maintenance using the current positions and applicable tier or portfolio rules.
  5. If the liquidation condition holds, run the venue-specific state transition before continuing the strategy.

Some events can share a timestamp without having a known ordering. Replay both plausible orders and report the difference. Crediting a transfer before a breach because both appear in the same one-minute bucket is an assumption, not a fact supplied by the data.

Sampling also creates a specific limitation. Daily closes cannot tell whether the boundary was reached between them. A bar low can reveal a possible breach for a simple long with unchanged collateral, but OHLC does not identify whether a transfer, funding debit or stop execution happened first. Use finer event data when available; otherwise report an unresolved range of outcomes. A finer grid improves the observation set but does not certify that all intervening events were captured.

5. Size positions against survival, then compare their returns

Conceptual illustration of position size and collateral allocation passing through a survival gate before performance comparison

The Kelly article addresses growth-oriented sizing. Add a feasibility layer around such a candidate size: specify the holding horizon, available collateral by account and permissible interventions, then replay them together. A Kelly fraction or historical drawdown cap alone does not specify that account state.

For each candidate allocation, retain the minimum buffer before the first forced exit, the exit timestamp, the resulting positions, realized costs and terminal wealth. Report the fraction of simulated paths that breach separately from the returns of surviving paths. Averaging performance only over survivors removes exactly the observations this exercise is meant to expose.

The bootstrap article provides tools for exploring uncertainty. To study margin survival, resampling only completed-trade returns is insufficient: the path inside a trade and the account's funding events have disappeared. A proposed extension is to resample synchronized blocks of relevant market events, replay signals and account state, and add explicit transfer-delay and price-gap stress scenarios. This requires suitable data; it is not a probability estimator delivered by the small script above.

If an estimated breach probability is used as a constraint, name the horizon, scenario generator and sampling uncertainty beside it. Zero breaches in a finite sample is an observation, not proof that liquidation is impossible. Stress scenarios without assigned probabilities should remain stress scenarios rather than being blended into a seemingly empirical probability.

The useful acceptance question is concrete: can the specified account keep the specified position through the tested path, using only collateral that is available at the time? A negative answer calls for a different position size, collateral allocation or intervention rule, followed by another replay. In the synthetic example, moving existing cash earlier changes survival without changing the market view or total starting wealth.

Research and scope. Sources checked on October 8, 2026: Hane, arXiv:2603.19716v1, March 20, 2026; Chitra, arXiv:2512.01112v3, February 16, 2026 revision; Bybit's official UTA liquidation documentation. The equations and deterministic experiment here are an illustrative account model, not a replication of either paper or an exchange liquidation engine.

blog.disclaimer

Authors

Eugen Soloviov
Eugen Soloviov

Trading-systems engineer

Trading-systems engineer building bots since 2017: cross-exchange arbitrage (connected up to 30 venues), cointegration-based pairs arbitrage across spot and futures, scalping, news and sentiment-driven strategies, trend algorithms, and portfolio management and balancing algorithms. Also builds sub-millisecond order execution, big-data warehouses, backtesting engines, AI agents, and trading interfaces (incl. open-source profitmaker.cc). Stack: JS/TS, Python, Rust/Zig/Go, DevOps, backend, frontend, architecture.

Newsletter

Bozordan bir qadam oldinda bo'ling

Sun'iy intellekt savdo tahlillari, bozor tahlili va platforma yangiliklari uchun bizning xabarnomaga obuna bo'ling.

Biz sizning maxfiyligingizni hurmat qilamiz. Istalgan vaqtda obunadan chiqishingiz mumkin.