Repository navigation
Releases: AlgorithmicMind/regimelab
Releases · AlgorithmicMind/regimelab
Release list
v0.4.0 - Next-Open Execution Ledger & Data-Quality Fixes
Highlights
- New opt-in
simulate_next_openandNextOpenResult: an explicit position ledger with opening fills, actual unit drift, publication ordering and observation masks. - Self-financing costs on risky buys and sells, cash accounting, and a benchmark using the same ledger conventions.
- Optional initial-equity baselines for drawdown and Calmar, including inception losses in the new ledger without changing legacy metric defaults.
Fixes And Compatibility
- HMM convergence metadata now describes the selected highest-likelihood restart. Model selection and fitted parameters are unchanged.
- The legacy overlay rejects missing, nonfinite or nonpositive prices needed for an exposed return or benchmark. Valid-input golden outputs are preserved.
- Warning migration: replace
non_session_asofwithasof_not_in_panel. Absence from a supplied panel does not prove market closure;is_stale=Falsedoes not by itself establish exchange-calendar freshness. - The legacy close-only API and pipeline defaults remain unchanged. Next-open execution is opt-in and requires caller-supplied, consistently adjusted prices and an exchange schedule.
See the execution contract and changelog for assumptions and migration details.
Validation
- 184 offline tests passed against an installed package, with tests run outside the checkout.
- Final release preparation changes documentation only; no functional code changes follow that validation.
- Ruff, formatting and strict MyPy checks pass.
- Wheel and source-distribution installation, dependency checks, module imports and both CLI entry points are verified on Windows / Python 3.12.4, without the optional Textual extra.
Distribution
This release includes the wheel, source distribution and SHA256 checksums. GitHub and PyPI publication are separate; PyPI upload is handled by the maintainer.
To install a downloaded wheel:
python -m pip install ./regimelab-0.4.0-py3-none-any.whlv0.3.0 - State Statistics, simulate_weights & Single Data Path
Highlights v0.3.0
- Typed regime statistics:
LabelAssignment.to_statistics()returns oneRegimeStatisticsper regime (training-window moments). States that share a regime — the positive-drift guardrail under VOLATILITY/SHARPE — are combined with occupancy-weighted moments, mirroring howrelabel_probabilitiessums their posteriors;raw_stateslists every member state, and return/volatility/Sharpe areNonefor a regime without weight.TelemetryPayload.state_statisticscarries them,statistics_for(regime)looks one up, andWalkForwardFold.statisticsholds each fold model's statistics. describe()keeps one row per raw state (as in 0.2.0), sorted by ladder position.- Correct signing model:
latest_telemetryuses the model and statistics of the fold that producedobservation_date, instead of always the last fold. simulate_weights: backtest any hand-supplied target-weight schedule under the same signal-lag, rebalancing and cost assumptions.run_backtestis reimplemented on it with numerically identical output (golden regression test).- Breaking (type consumers):
BacktestResult.regimesandregime_metricsare optional (Nonewhen a weight path rather than a regime signal was simulated). - Fix: leading sessions whose confidence is below the floor now hold 100% CASH and earn the risk-free rate, instead of holding zero weights and earning nothing.
- Breaking — single data path: the pipeline fetches through
load_aligned_panel. The panel cache moves fromartifacts_dir/cachetodata.cache_dir, panels are reused withindata.cache_ttl_hours(the TTL is no longer forced to 0) and alignment anchors ondata.calendar_anchor;force_refresh=Truerestores always-refetch. RankingMethod.SHARPEdocstring now states it is no longer any classifier's default (hmm/hamilton→STRESS,gmm→VOLATILITY).
Full details in the CHANGELOG.
v0.2.0 - Causal Walk-Forward, Stress Labelling & Official VIX Sourcing
Highlights v0.2.0
- Causal walk-forward fix: each fold now labels only the interval strictly after its own training window,
(r_k, r_{k+1}], filtering the full history from the stationary distribution with frozen parameters — the previous model's posterior is no longer carried forward. - Stress labelling (breaking): HMM and Hamilton models rank states by signed stress features via
RankingMethod.STRESS; the positive-drift guardrail no longer applies under STRESS. Signs are configurable withModelSettings.stress_signs. - Official volatility sourcing:
^VIXand^VIX3Mare read from CBOE first, then FRED, with the configured provider as fallback (volatility_source="official"). - Data-quality telemetry:
TelemetryPayloadgainssession_date,observation_date,is_staleand populated warnings (non-session as-of dates reported separately from stale data). - Signal vs. investable universes:
DataSettings.correlation_assetsdecouples the correlation features fromrisk_assets, which now only drives allocation and the backtest. - Live signal = backtest signal (breaking):
run_single_asofdefaults torefit_policy="walkforward", reproducing the walk-forward posterior exactly (train_end= last refit strictly before the observation date);refit_policy="daily"keeps the previous behaviour.
Full details in the CHANGELOG.
v0.1.5 - Model Persistence & Economic Labeling Guardrails
Highlights v0.1.5
- Economic Guardrails: Positive-drift states can no longer be assigned to HIGH_VOL_BEAR or RISK_OFF.
- Model Persistence: Added \FittedRegime.save()\ and \FittedRegime.load()\ using np.savez_compressed + JSON.
- Causal Daily Inference:
un_single_asof\ now accepts \itted\ models to run causal Hamilton filtering without retraining.
v0.1.4 - Settings extra='ignore' and foreign env fix
Changes in 0.1.4
- Switched
Settings.model_configfromextra="forbid"toextra="ignore"to prevent foreign environment variables (e.g.,GOOGLE_API_KEY,DATABASE_URL) from raising validation errors in host applications. - Retained strict
REGIMELAB_prefix parsing and immutability (frozen=True). - Added regression test for environment pollution.
v0.1.3
🚀 Improvements in v0.1.3
- Interactive CLI Telemetry: Added granular Rich progress bar and time-remaining estimation across walk-forward folds.
- Pipeline Callbacks: Exposed
progress_callbackandstatus_callbackhooks inrun_pipelineandrun_walk_forwardfor external integration. - Performance Profiling: Streamlined fold boundary dispatching during expanding-window simulations.
v0.1.0 — Institutional Point-in-Time Regime Engine
🚀 What's New in v0.1.0
Initial institutional-grade release of RegimeLab: a deterministic market regime detection engine, systemic risk telemetry pipeline, and walk-forward adaptive asset allocation framework.
Key Features & Architecture
- Strict Point-in-Time Alignment: Native
asoftemporal cursors and lagging logic ensuring zero look-ahead bias across all multi-asset inputs. - Three Core Classifiers:
- Hamilton Markov-Switching Regression (
statsmodels). - Multivariate Gaussian Hidden Markov Models (
hmmlearn). - Gaussian Mixture Models (
scikit-learn) with ridge covariance floor.
- Hamilton Markov-Switching Regression (
- Canonical State Ordering: Deterministic state labeling to mathematically prevent label switching across rolling folds.
- Systemic Risk Telemetry: Kritzman Absorption Ratio (PCA), VIX Term Structure (Contango/Backwardation), and Breadth momentum over Sector SPDR baskets.
- Walk-Forward Engine: Expanding-window backtesting with out-of-sample parameter freezing and realistic transaction cost modeling.
- Dual Presentation Layer: Static Rich CLI dashboards, interactive Plotly HTML reports, and Textual TUI.
- Formal Verification: Causality property-based tests via
hypothesisand strict static typing withmypy.