A healthy loan can become a system-wide problem.
A position can look safe at current prices yet become vulnerable after a modest collateral decline. The project asks how to move from individual loan health to protocol-level risk, including what happens after liquidation begins.
The key question is whether collateral sales into finite market depth can push prices down further and trigger secondary liquidations.
Model the feedback, not only the first shock.
- Calculate loan-to-value, health factor, liquidation price, and distance to liquidation for each position.
- Apply common or asset-specific ETH, BTC, and SOL shocks.
- Iteratively liquidate eligible positions using configurable close factors, liquidation bonuses, and market depth.
- Convert seized collateral sales into additional price pressure, then recalculate positions until the cascade stabilizes or reaches its round limit.
The engine separates first-order exposure from cascade-created exposure, collateral sold, debt repaid, and residual bad debt.
Compare outcomes under the same market draws.
Correlated Monte Carlo scenarios support Normal and Student-t return assumptions. Each market draw is evaluated with and without liquidation feedback, allowing paired comparisons of cascade amplification and bad-debt tails.
- Reverse stress testing searches for the smallest modeled decline that breaches a chosen risk threshold.
- Historical calibration estimates asset volatility and correlations from market prices.
- Leave-one-asset-out and exact Shapley attribution explore which assets contribute to modeled tail outcomes.
- Market-depth and liquidation-parameter sweeps expose sensitivity to assumptions.
Make experiments inspectable and replayable.
A Streamlit dashboard exposes stress ladders, cascade paths, tail risk, reverse stress tests, and attribution. Saved simulation bundles preserve positions, market draws, resolved settings, version information, and checksums; comparison tools distinguish paired draws from separate descriptive runs.
The repository includes tests for accounting consistency, input validation, scenario reproducibility, shock isolation, exposure bounds, and reverse-stress behavior. These are model-based stress experiments, not forecasts of market returns or exact exchange execution.