SEK·All projects ↗

2026 / quant · data

Market Regimes & Dynamic Allocation

Lower drawdown, honestly reported trade-offs.

Walk-forward HMM regimes combined with Markowitz allocation, fractional Kelly exposure and transaction costs across US factor ETFs.

  • Python
  • hmmlearn
  • cvxpy
  • pytest
Tracked strategy and benchmark performance
Repository-linked project visual

01 / PROBLEM STATEMENT

Why this work exists

The study asks whether regimes inferred strictly from information available at each date can improve dynamic allocation relative to transparent static benchmarks.

Data and source material

  • Adjusted prices for SPY and MTUM, VLUE, QUAL, and USMV
  • 2,431 tracked observations from 3 May 2016 through 31 December 2025
  • SPY return, volatility, z-score, and drawdown features

02 / SOLUTION OVERVIEW

From input to usable output

Expanding-history HMM refits, forward filtering, one-day signal lagging and explicit 5 bps turnover costs enforce chronology.

  1. 01

    Warm up on 252 observations

  2. 02

    Refit a three-state Gaussian HMM on expanding history

  3. 03

    Forward-filter state probabilities and lag the signal one day

  4. 04

    Estimate factor returns and covariance from prior data

  5. 05

    Apply constrained Markowitz weights, half-Kelly exposure, and turnover costs

03 / TECHNICAL ARCHITECTURE

Implemented components

Documented component map
01

Prices → lagged features → walk-forward HMM → risk aversion → constrained allocation → costs

Diagram synthesized from the pinned repository documentation; it is explanatory, not a runtime topology capture.

04 / METHODOLOGY & IMPLEMENTATION

Decisions that shape the system

  • No future-state smoothing is used; state probabilities update one observation at a time.
  • All strategies share the same post-warm-up dates.
  • Long-only factor weights sum to one and are capped at 75% per factor.
  • Optimized portfolios pay 5 bp per unit of one-way turnover; robustness scenarios vary states, refits, lookbacks, costs, and Kelly fraction.

Implemented capabilities

  • Three interpreted regimes
  • Regime-conditioned allocations
  • Half-Kelly exposure
  • Robustness scenarios and integrity tests

05 / RESULTS & EVIDENCE

What the source supports

  • Dynamic net strategy: 9.49% CAGR, 12.87% volatility, 0.614 Sharpe, and −19.65% max drawdown.
  • SPY: 14.99% CAGR, 18.06% volatility, 0.754 Sharpe, and −33.72% max drawdown.
  • The regime strategy reduced volatility and drawdown but did not improve return or Sharpe.

Results preserve the repository’s units, evaluation framing, and stated limitations. Missing evidence is not converted into a claim.

06 / CHALLENGES & LIMITATIONS

Where the evidence stops

  • Yahoo Finance is not an institutional point-in-time source.
  • The risk-free rate is constant and costs omit spreads, impact, taxes, and ETF fees.
  • Latent regime labels and portfolio parameters are estimation-sensitive.

07 / WHAT THIS DEMONSTRATES

Engineering signal

Leakage-aware regime modelling, portfolio optimization, risk scaling, transaction-cost accounting, benchmark alignment, and honest reporting of an informative non-win.

08 / SOURCE & RELATED WORK

Trace the evidence

Audited files

README.md · tests/ · outputs/strategy_performance.png · sensitivity_analysis.py