Causal Macro-Financial Stress Indices, Cross-Sectional Stress Betas, and Regime Conditioning in quarcc-risk-regime
How QUARCC constructs 15 strictly causal monthly market-trend, volatility, credit, sentiment, and margin-debt indicators in Rust, estimates orthogonalised stock-level stress betas, and separates deterministic reproduction from in-sample overlay diagnostics.
This post accompanies our research paper, Causal Macro-Financial Stress Indices, Cross-Sectional Stress Betas, and Regime Conditioning in quarcc-risk-regime (quant-fund/papers/risk-regime/), documenting the packages/risk-regime and packages/factor-primitives Rust crates.
The resulting 327-month reference panel (reference/risk_regime_monthly.csv) powers the regime-attribution tables on our live strategy pages—QUARCC Market Neutral US Quant Fund and QUARCC US Long-Short Equities—and in our updates on QUARCC LinkedIn.
1. Fifteen Causal Monthly Risk & Regime Indicators
Conditioning equity portfolios on macro-financial stress requires strictly point-in-time indicators that never leak future sample moments or unannounced macro releases. The quarcc-risk-regime crate (packages/risk-regime) maps daily S&P 500 OHLC bars, daily CBOE VIX closes, monthly ICE BofA High Yield and Investment Grade Option-Adjusted Spreads, weekly Thursday AAII Bearish survey readings, and publication-lagged FINRA margin debt into a 15-column monthly panel:
- Multi-Horizon Returns & 12–1 Momentum (
src/price.rs):ret_1m,ret_3m,ret_6m, and Fama–French skipped-month momentummom_12_1(Cooper, Gutierrez, and Hameed, 2004). - Moving-Average Distances (
src/price.rs):dist_ma_6manddist_ma_10mfor inclusive of month . - Normalised 14-Day Wilder ATR (
src/atr.rs): Daily Wilder (1978) Average True Range divided by month-end close (atr) and its 1-month change (atr_chg_1m). - Online Welford Expanding Z-Scores (
src/expanding.rs): Using Welford’s (1962) single-pass online recurrence from panel inception (, sample denominator ), the engine standardises:- Credit spreads:
hy_zscore() andig_zscore() on ICE BofA US High Yield and Corporate OAS (Gilchrist and Zakrajšek, 2012; Friewald, Wagner, and Zechner, 2014). - Intramonth volatility range:
vix_range_zscore() on the within-month VIX close range (Ang et al., 2006; Moreira and Muir, 2017). - Investor sentiment:
aaii_bearish_zscore() on the final Thursday AAII Bearish survey reading in month (Baker and Wurgler, 2006). - Publication-lagged margin debt: Enforce a 1-month publication lag over a 6-month change window (
md_6m_chg_pctandmd_6m_chg_zscore), capturing broker-dealer funding contractions (Brunnermeier and Pedersen, 2009; Adrian and Shin, 2010).
- Credit spreads:
- Composite Stress Index (
src/composite.rs):
2. Cross-Sectional Stress Betas and Companion Primitives
To measure whether an individual equity or long–short portfolio is exposed to funding and volatility shocks independently of its market beta, src/exposure.rs estimates a bivariate OLS regression for each asset over months (), extending Ang, Chen, and Xing (2006) and Agarwal, Ruenzi, and Weigert (2017):
The crate also provides conditional stress-up betas (), upper-tail stress betas (), prior shrinkage , sector stress aggregation (src/portfolio.rs), bivariate scenario PnL , and book/alpha conditioning operators (src/conditioning.rs):
In packages/factor-primitives, these monthly operators are paired with daily and cross-sectional primitives: Markov transition powers and entropy (markov.rs), Baum–Welch/Viterbi Gaussian HMMs (hmm.rs), variance-targeted GARCH(1,1) / GJR-GARCH(1,1) (garch.rs), the multiplicative two-component MF2-GARCH-rw-m model of Conrad and Engle (2025) (mf2_garch.rs), and RiskMetrics/Newey–West/Vasicek/HAR-RV/QLIKE factor-risk estimators (risk/).
3. Computational Reproduction vs. In-Sample Diagnostics
A core methodological discipline of our paper is separating deterministic software verification from in-sample investment diagnostics:
A. Deterministic Verification (327 Months, July 1999 – September 2026)
- Golden Fixture (
tests/first_year.rs): All 15 metrics match the 12-month golden fixture (1999-07to2000-06) to within . - Full 327-Month Public Reconstruction (
repro/reproduce.py): Across all 327 months from July 1999 to September 2026, all price, momentum, moving-average, ATR, and FINRA margin-debt series match the reference CSV to –; minor deviations in credit and VIX z-scores reflect historical FRED ICE BofA OAS revisions and a single July 2002 VIX close vendor revision ().
B. Production Fact-Sheet Attribution & In-Sample Strategy Diagnostics
- Live Fact-Sheet Regime Attribution (
live-strategies/factsheet.py): Partitioning monthly returns of our live QUARCC Market Neutral US Quant Fund and QUARCC US Long-Short Equities books across S&P 500 up/down months,dist_ma_10mtrend terciles, and laggedvix_range_zscoreterciles provides transparent, zero-tuning performance attribution. - In-Sample
A-030Stress Attribution & Overlay Diagnostic (T = 68months, 2021–2026): RegressingA-030monthly returns on and confirms near-zero realised stress beta (), while holdings-based sector attribution reveals a small active sector stress tilt from net long Financials () and IT () against short Health Care (). Applying with raises in-sample Sharpe from to , but only 9 of the 68 months have —making this strictly an in-sample diagnostic, not an out-of-sample alpha proof. - In-Sample
v4b-monthlyFactor-Risk Port (T = 116months, 2017–2026): Replacing the untuned monthly port ( excess return, max drawdown) with thefactor-primitivesWLS/EWMA/shrunk-specific risk stack raises 2017–2026 excess return to and cuts max drawdown to (evaluated in-sample across the full 116-month window).
Read the Full Paper & View Live Regime Attribution
- Paper PDF:
papers/risk-regime/risk-regime-2026.pdf - LaTeX Source:
papers/risk-regime/risk-regime-2026.tex - Crate Source:
packages/risk-regime - Live Strategy Fact Sheets: QUARCC Market Neutral US Quant Fund & QUARCC US Long-Short Equities