about
Regim: A Market Microstructure & Optimal Execution Research System
A quantitative finance research platform that detects market regimes using machine learning and proves that hard-coded regime-aware execution outperforms standard baselines, validating a key finding from reinforcement learning research.
I wrote a research paper establishing that RL agents cannot reliably exploit market regime information for optimal trade execution, even when the regime label is explicitly in their state space. The failure is structural: PPO training converges to qualitatively different policies depending on random initialization, sometimes producing inverted regime sensitivity, executing more aggressively in bear markets than bull markets, directly contrary to domain knowledge.
The paper concludes that hard-coded regime conditioning bypasses an optimization problem that standard policy gradient methods cannot solve reliably. This system is that conclusion made operational.
A 4-state Gaussian HMM detects crash, bearish, transitional, and bullish regimes across 8 assets in real time. The crash state identification, selecting the highest-volatility state among the two lowest-return states, resolves a conflation the paper's two-state simulation couldn't expose: crash vol is 1.3–2× higher than bearish, with completely different execution implications (halt vs patient limits).
Walk-forward out-of-sample validation with three simultaneous statistical tests (paired t-test, permutation test with 1000 shuffles, binomial test) and Bonferroni correction establishes where regime-aware execution actually works. High-confidence signals outperform; low-confidence transition zones (~23% of trading days) show no significant edge. Knowing when not to use the model matters as much as building it.
Three research extensions go beyond the original paper: regime-conditional GARCH(1,1) reduces 5-day volatility forecast RMSE vs unconditional models; Bayesian changepoint detection (PELT) identifies regime switches a median of 1.5 days earlier than HMM Viterbi smoothing; FRED macroeconomic attribution maps statistical regimes to real fundamentals, finding VIX correlation ρ=−0.745 with crash regimes averaging 2.4× higher VIX than bullish regimes.
The Paper vs Reality tab places CTMSTOU simulation parameters directly against empirically learned HMM transition rates. The Statistics tab surfaces every p-value, confidence interval, and permutation result in one place.
Website design inspired by Zajno Digital Studio