Works with the AI Agents you already use
Liquidation Risk Simulation
by BanditXBT
Monte Carlo and historical-replay stress tests to size leverage, margin and insurance funds.
$3.15
About this skill
Goal: choose parameters (max leverage, maintenance margin, liquidation penalty, OI caps, insurance size) that keep **bad debt probability and magnitude** within a stated tolerance under realistic stress, including keeper failure. 1. **Positions:** distribution of size, leverage, side, collateral type. Calibrate to real data (on-chain events, subgraph exports) or conservative worst-case concentrations (top-N accounts = x% of OI). 2. **Price paths:** simulate at the oracle/block resolution, not daily. - Baseline: GBM with volatility from realized vol (EWMA or GARCH for clustering). - Tails: add jump process (Merton/Kou) and fat tails (Student-t); calibrate jump frequency/size to historical crashes. - **Historical replay:** feed actual minute/second data from past cascades (e.g., Mar 2020, May 2021, Nov 2022, Oct 2025) and gap events; replay is more honest than any parametric fit. Oct 10, 2025 liquidated roughly $19B in about a day and triggered auto-deleveraging that closed profitable opposite-side positions on some venues: replay it including ADL and cross-margin effects, and expect venue-level data (liquidation feeds are incomplete; some venues report only samples). - **Correlation:** collateral and positions correlate to 1 in crashes; do not diversify with calm-period correlations. 3. **Liquidation engine:** replicate the contract rules exactly (maintenance margin, close factor, penalty split, min size, oracle mark/TWAP lag). 4. **Keeper/market frictions (the part that causes real bad debt):** - Liquidator latency distribution and capacity per block; failure probability when gas spikes or the chain is congested. - Oracle lag (heartbeat/deviation) and update delay → liquidations trigger late. - Slippage/price impact when closing large positions on the hedge venue or AMM (square-root impact: `impact ≈ k·σ·√(Q/ADV)`). - Sequencer outage window (no liquidations, then price gap on restart). 5. **Loss waterfall:** position equity → liquidation penalty → insurance fund → LP/vault/ADL/socialization. Record which layers are hit. - Bad debt: P(any), expected, 95th/99th/99.9th percentile (CVaR/expected shortfall of bad debt). - Insurance fund drawdown and time to depletion; ADL trigger probability. - Liquidation shortfall: % notional liquidated late (equity < 0 at execution). - Liquidator profitability vs. gas: minimum position size where liquidation is net-positive per chain. - LP/vault PnL tail (for pool-counterparty designs); skew/OI-imbalance exposure. Sweep leverage × maintenance margin × penalty × cap. Plot the frontier: capital efficiency (OI / collateral) vs. 99.9% bad debt. Rule of thumb check: maintenance margin must exceed the **expected adverse move during the liquidation delay**: `MM ≳ z · σ_per_√time · √(delay)` + slippage buffer, with `z` set from the tail (≥ 3-4 plus jump allowance). Re-run when volatility regime or asset liquidity changes; per-asset parameters, not one-size.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago
- Software
Python 3numpypandas
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.