Correlated Monte Carlo Flash Crash Stress Test.

XLM-anchored crash propagation across a 13-asset crypto book. Cholesky-correlated idiosyncratic shocks, full-distribution tail metrics. Everything runs locally in this page.

Engine vanilla JS · Box–Muller + Cholesky

Control Panel

The anchor scenario drives every other asset through its crash beta.

Portfolio Assumptions

Editable — starting spot price and crash beta vs. the XLM anchor move.
Asset Starting Spot Price ($) Crash Beta (β) Interpretation

Stress Test Results

No simulation yet — set your assumptions and hit Run Stress Test.
Methodology & math engine
  1. Anchor sampling. Each run k draws an anchor landing price uniformly from the target range, giving the anchor return R_anchor,k = P_land / P_spot,anchor − 1.
  2. Correlated shocks. A 13×13 correlation matrix Σ is built from asset-class blocks (anchor / majors / memes / alts) and decomposed with a pure-JS Cholesky routine so that L·Lᵀ = Σ (diagonal jitter is added automatically if Σ is not numerically positive-definite). Independent N(0,1) draws Z come from the Box–Muller transform and are mapped to correlated normals via the matrix product X = L·Z.
  3. Downside noise. ε_i,k = σ_i · X_i,k with σ_i = (noise% / 100) · |R_anchor,k|, so idiosyncratic dispersion scales with crash severity. Negative draws are additionally multiplied by 1.35 to produce the fat left tail characteristic of a liquidity flash crash.
  4. Asset return. R_i,k = β_i · R_anchor,k + ε_i,k, floored at −99.5%. The anchor leg lands inside your target band by definition, so it takes neither a beta nor idiosyncratic noise. Landing price is P_i,k = P_spot,i · (1 + R_i,k).
  5. Metrics. Computed on the full sorted price distribution: mean; 95th percentile (mild-tail upper floor); 5th percentile (95% VaR); 1st percentile (99% VaR); the average of all outcomes at or below the 1st percentile (99% CVaR / expected shortfall); and max drawdown from the single worst run, min(P_i,k) / P_spot,i − 1.

The seed field drives a deterministic Mulberry32 PRNG, so a given configuration reproduces exactly; set it to 0 for a fresh random stream each run. Note that with high betas, a deep anchor crash and large noise, returns can hit the −99.5% floor — when the 95% and 99% tail figures for an asset are identical, that floor is binding and the tail is truncated rather than estimated.

Correlation Matrix (Σ)

Block structure by asset class — the input to the Cholesky decomposition.

What This Means — Plain English

Written for a reader seeing this dashboard for the first time.

What this tool does

It answers one question: “if my anchor asset crashes to somewhere between my two target prices, where does the rest of my crypto book probably land?”

Rather than guessing a single number, it replays the crash thousands of times. Each replay picks a slightly different landing price for the anchor inside your target range, then pushes that shock out to every other coin through two dials you control: its beta (how hard it amplifies or dampens the anchor's move) and the noise setting (how much each coin can wander off its beta on its own).

Crucially, that wandering is correlated, not independent. In a real flash crash coins do not fall in isolation — majors move together, memes move together, and everything moves somewhat with everything else. The correlation matrix at the top of this page encodes those relationships, and the Cholesky decomposition is the piece of maths that makes the random draws respect them. Ignore that step and you get a comfortably wrong answer, because independent randomness quietly cancels itself out and hides your true tail risk.

The result is a full distribution of landing prices for every asset. The results table reports the middle of that distribution and — more importantly — its bad end.

What your scenario showed

  • Run the stress test to generate a reading.

How to read the columns

Starting Spot
Today's price you typed in — the baseline every loss is measured against.
Mean Landing
The average outcome across all runs. A reasonable central expectation, but it deliberately hides the tails.
95% Upper Floor
The mild end: only 5% of runs finished better than this. Treat it as a realistic good case, not a target.
95% VaR
The 5th percentile. 95% of runs finished at or above this price, so 1 run in 20 was worse. This is the standard “bad day” planning number.
99% VaR
The 1st percentile — the black-swan line. Only 1 run in 100 was worse.
99% CVaR
Expected shortfall: the average of that worst 1% of runs. It answers “if the black swan does show up, how bad is it typically?” — always at or below the 99% VaR, and the honest number for sizing a worst case.
Max Drawdown
The single worst run out of all of them. Useful as a stress bound, but it is one draw of noise, so read it as a limit rather than a forecast.
What this is not. Every number here is a consequence of the assumptions you entered — the target range, the betas, the noise level and the correlation blocks. It is a way to see how those assumptions interact and where your portfolio is most fragile, not a prediction of prices. Low-liquidity and high-beta names in particular will always look violent here, which is the model working as intended rather than a signal about them.