1. Per-stock systemic risk (zsys)
For each stock we build a rolling window of log returns and run a patch-masking stress test on a foundation forecaster (Chronos-2 by default). The window is split into n equal patches; each patch is masked in turn and the forecaster predicts the next H steps. Sensitivity is cosine distance between baseline and masked forecasts; uncertainty enters via predictive quantile spread.
Per-patch stress:
εᵢ = δ · sensitivityᵢ + λ · |Var(masked) − Var(baseline)|
The instantaneous stress signal S(t) at each timestep is the maximum patch
stress among patches covering that point.
2. Risk dynamics
The scalar stress drive is integrated through a nonlinear dynamical system that smooths short-lived spikes into a persistent risk state and captures regime-like buildup:
dz/dt = α · S(t) − β · z² − γ · z
Parameters α (excitation), β (nonlinear damping), and γ (linear decay) control how fast
risk accumulates and mean-reverts. The trajectory z(t) is integrated
numerically. The systemic risk score used in aggregates is
zsys(t) = z(t) at the end of each rolling window.
3. Per-stock thresholds
On a training sample of windows, we collect the maxima of zsys and
set an alert threshold:
Z_thr = (1 + margin) · quantile(z_sys_max, q)
A complementary Z_low threshold flags unusually low predictability
(complacency). Each ticker keeps its own calibrated pair.
4. Stress indicator — pooled thresholds
All in-index zsys values on the training calendar are pooled. Fixed
low/high quantiles (default ⅓ and ⅔) define two absolute thresholds applied to every date.
For each day we report:
- % low stress — share of active names with zsys below the low threshold
- % alert stress — share above the high threshold
Index price (S&P 500 or WIG20 ETF) is shown on the left axis; percentages on the right (0–100%).
5. Market stress index — per-stock thresholds
Here each name is compared to its own Z_thr (and optionally Z_low):
- Stress breadth — % of scored constituents with zsys > Z_thr
- Stress breadth EMA20 — 20-day exponential moving average of breadth
- Complacency breadth — % with zsys < Z_low (when calibrated)
- Stress intensity — among names in alert, mean of zsys/Z_thr mapped linearly to a 1–100 scale
Dual-panel view: index price + breadth on top, intensity below — same construction for S&P 500 and WIG20.
6. Data & updates
Daily OHLCV is ingested into TimescaleDB. Per-stock scores are updated incrementally; aggregate
indicators and alert episodes are recomputed by the jobs.indicators pipeline.
S&P 500 membership is point-in-time from historical constituent lists; WIG20 uses the
current index portfolio.