Crypto risk monitor v0.1.0

Built 2026-10-19T06:26:34+00:00 · commit c5735af088 · a risk-and-context instrument for a tiered crypto universe, not a forecasting engine

Methods

Each front-page panel restated in prose from the lecture notes, with a link to the code that implements it. Thresholds are frozen in config/thresholds.yaml (calibrated once, recalibration is a governance event). Every number on the page carries the source table, fetch time and commit; the data status page lists freshness per table.

1. Venue and counterparty (notes Section 6)

The largest losses in the history of crypto funds were venue events, so this panel comes first. Each venue gets an ordinal score from six inputs kept in config/venues.yaml: regulatory domicile and licensing, segregation of client assets, the quality of proof of reserves (a Merkle attestation of assets is not proof of solvency without liabilities), withdrawal-halt history, the share of volume failing the wash filters, and concentration in the venue's own token. Exposure limits decrease with the score: Xv ≤ x̄v·NAV per venue and an aggregate cap on low-score venues. Stablecoin exposure is shown with the discount to par (a de-peg is a margin event on every position collateralised in it), and a short hand-tracked list of systemic exposures replaces a full contagion matrix. Code: compute/venue.py.

2. Book risk (notes Section 8)

Kelly sizing on forecasts with R² of a few percent converts estimation error into losses (Proposition 8.1), so the book is sized by volatility targeting with drawdown control. The covariance is the state-weighted mixture Σt = ξhighΣ̂(high) + (1 − ξhigh)Σ̂(low) + η Φt+(Σ̂(high) − Σ̂(low)) with Ledoit–Wolf shrinkage on observations weighted by the filtered vol-state probability, tilted toward the stress covariance when the fragility index is positive. The panel reports gross and net exposure, the factor exposure vector w′B, the effective number of bets under the current and stress covariance, the 5 % expected shortfall by simulation with Student-t innovations, the P&L if all liquidations within 2σ trigger at once, the P&L of a 50 % drawdown in each systemic exposure and of a withdrawal halt at each venue (exposure marked to a recovery assumption). Code: stress/.

3. Market state (notes Section 3)

A three-state Markov-switching model with covariates has more parameters than the sample has regime transitions, so the state is measured by observables with a mechanical link to forced flow. The fragility index is the mean of five components: four 250-day robust z-scores (OI-weighted funding, open interest over cap, the negative of the variance risk premium, the negative of stablecoin growth) and the 90-day range position 4·(pos₉₀ − ½), a bounded score in [−2, 2] that replaced the drawdown z on 2026-09-08 (review decision 3: a positioning summary, not a validated predictor of post-shock damage).4826): OI-weighted Tier 1 funding, aggregate open interest over Tier 1 market cap, the negative of the BTC variance risk premium, the 90-day range position, 4·(pos₉₀ − ½), mapped to [−2, 2], and the negative of 30-day stablecoin supply growth. It measures the size of the pile of dry material, not the timing of the spark. Net USD liquidity (Fed balance sheet − TGA − RRP, units reconciled), real yields, the dollar and VIX are context only. A two-state switching model on log realised vol is kept as an explicitly uncertain summary: filtered probabilities only, expected duration 1/(1 − pjj), parameter standard errors on the diagnostics below. Code: compute/state.py.

4. Active triggers (notes Section 4)

Funding, open interest, liquidation structure and scheduled supply are the signals with demonstrated out-of-sample content, so they are stated as hard-threshold rules rather than diluted into a composite. Rule 4.1 (crowded long): zFR > 2, OIrel above its 90th percentile and Λ−(2)/D(0.02) > 1 — reduce or hedge longs. Rule 4.2 (capitulation): zFR < −2, OI down more than 20 % in 5 days, 24-hour long liquidations above their 95th percentile — candidate mean-reversion long sized by the gate. Rule 4.3 (vol underpricing): VRP < 0 and Φ > 1 — no short-vol positions. Rule 5.1 (cliff): a single unlock above 1 % of float or two days of real volume. The liquidation density λ(p) is estimated from positive daily OI increments attributed to the day's close, split by the Binance top-trader long share and an assumed leverage distribution (documented in thresholds.yaml); Λ±(κ) integrates it within κσ√h of the current price. Historical hit rates with their sample sizes come from the walk-forward backfill and are shown in the table below; they are small samples and not forecasts. Code: rules/, compute/positioning.py.

5. Trade structures (notes Section 5)

Cash-and-carry basis (long spot, short a dated future; annualised basis b = (F − P)/P · 365/(T − t); net of stablecoin financing and fees; the dominant risk is the futures venue), funding carry (long spot, short perp; planning return = 30-day trailing OI-weighted funding shrunk toward zero; most attractive when Rule 4.1 fires), volatility selling on the majors (VRP; forbidden by Rule 4.3; sized by the 3σ loss under the high-vol state's σ), and unlock shorts (flagged cliffs 2–4 weeks ahead, warning when the short is crowded). Each row shows gross, cost, net, the execution venue and its score. Code: compute/trades.py.

6. Event strip

Cliffs in days of real volume (DefiLlama schedule by recipient class), governance votes ending (Snapshot), hand-maintained upgrades, listings and regulatory dates (config/events.yaml, reviewed weekly through an issue), and large options expiries (Deribit open interest by expiry, largest strike). Code: compute/context.py.

7. Tier 2/3 screens and the liquidity gate (notes Sections 7 and 9)

Cross-sectional predictors have a short and unstable record, so the cross-section is a set of screens that condition attention, each with its trailing 52-week Spearman information coefficient and standard error so nobody mistakes a screen for a forecast. Characteristics are standardised within sector (median/MAD, winsorised at ±3). The factor model (MKT, SMB, MOM, LIQ, sector; 26-week rolling regressions with 8-week half-life) is used only to compute the book's exposure vector. The liquidity gate uses order-book depth at 2 % (intraday median across venues with genuine books) and wash-filtered volume: no position whose days-to-liquidate at 10 % participation exceeds 3, or whose round-trip square-root impact exceeds a quarter of its expected net return. Code: compute/crosssection.py, compute/liquidity.py.

Universe (notes Section 2)

One common factor explains most of the variance, so a 200-asset dashboard is a BTC beta call in disguise; the universe is tiered by tradability and full daily attention goes to the 15–25 names that can be traded at size. Membership history is stored so backtests use membership as of each date. See the universe page.

Validation tables (walk-forward)

loading data/daily.json …

Fragility index: components and definitions

Φ is the mean of five components. Four are 250-day walk-forward robust z-scores (MAD × 1.4826): OI-weighted Tier 1 funding; aggregate OKX open interest over Tier 1 market cap; the negative of the BTC variance risk premium (DVOL² − RV²₃₀, the daily DVOL history plus today's live DVOL); the negative of 30-day stablecoin growth. The fifth, since 2026-09-08, is a bounded range-position score: pos₉₀ = (P − min₉₀)/(max₉₀ − min₉₀) and z_dd = 4·(pos₉₀ − ½) ∈ [−2, 2], with no standardisation. It replaces a robust z of the drawdown from the 90-day high, which is bounded at zero and, over a downtrending window, made any day near the high a tail event: on 2026-09-08 it read +2.53 for a price 2.7 % below the high. The mechanical reading is unchanged (at the top of the recent range the liquidation mass sits below). Each component carries its sample size; a component that is null while its source is fresh fails the build rather than publishing Φ on fewer components; a stale source is shown as a gap in the state reading. History and live values come from the same builder.

Does Φ predict the damage after a shock?

loading data/daily.json …

Exchange tokens: within-sector relative value and dispersion

loading data/daily.json …

Resistance / support tests: the two objects, calibration, and the Φ answer

loading data/daily.json …

Trend state: continuation base rate and the Φ interaction

loading data/daily.json …

Vol-state diagnostics

loading data/hourly.json …

Factor model

loading data/risk.json …