ENGINEERING CASE STUDY / 2026
QuantLab
Historical strategy results, treated as evidence rather than promises.
QuantLab is a compact framework for systematic portfolio experiments with explicit assumptions around signal formation, execution, transaction costs, risk and reproducibility. H001 tests whether a time-series momentum risk gate changes the risk-adjusted behaviour of an inverse-volatility ETF portfolio.
H001 complete. Historical research experiment, not a deployable trading claim.
- H001
- Exposure-matched
- Baseline
OVERVIEW
What was built, how it was evaluated, and what remains limited
QuantLab separates reusable data, feature, portfolio, simulation and evaluation components from research-specific experiment construction. H001 compares a fully invested inverse-volatility baseline with a momentum-gated strategy and an exposure-matched control.
- Built: data loaders, return/volatility/momentum features, inverse-volatility allocation, exposure matching, next-close execution, accounting and metrics.
- Evaluated: historical ETF data, 10 bps costs, four cost scenarios, four subperiods, a nine-combination parameter grid and 35 tests.
- Limited: historical descriptive results, retrospective universe selection, no pristine out-of-sample dataset and no causal performance claim.
KEY ENGINEERING DECISION
Next-close execution and exposure-matched attribution
A signal calculated with close(t) is executed at close(t+1), so the new target first earns the return from close(t+1) to close(t+2). Because H001 spends substantial time in cash, an exposure-matched control preserves the baseline relative ETF composition while matching H001's target aggregate ETF exposure at every rebalance. This separates part of the cash effect from the momentum gate.
PROBLEM AND DECISIONS
How do you know a backtest result is not an artifact?
The central problem is not finding a higher Sharpe ratio. It is separating a signal effect from execution timing, transaction costs, risk exposure and retrospective data choices.
Problem
H001 asks whether a 252-session excess-momentum risk gate changes the risk-adjusted behaviour of an inverse-volatility ETF portfolio. The baseline is fully invested. H001 sets an ETF target weight to zero when excess momentum is non-positive and moves the removed allocation to cash. Surviving ETF weights are not renormalized.
Constraints
- Historical descriptive results, not evidence of alpha or future profitability.
- Retrospective ETF-universe selection.
- No pristine untouched out-of-sample dataset.
- Simplified proportional transaction costs, no bid-ask spread or market impact.
- Cash return derived from FRED DGS3MO.
ARCHITECTURE
A research framework with explicit assumptions.
Research-specific experiment construction is kept separate from reusable data, feature, portfolio, simulation and evaluation components.
DATA
shared observed sessions
SIGNALS AND PORTFOLIO
annualized with sqrt(252)
monthly rebalance
SIMULATION
gross traded notional
SHA-256, versions, Git metadata
Execution convention
Signal and target calculated using observed data.
Target executed at the next observed session.
The new target first earns the next session's return.
This deliberately avoids treating information observed at close(t) as executable at the same close. Portfolio weights drift naturally between rebalances.
BACKTEST VALIDITY
Execution, costs and attribution are explicit.
The experiment includes an exposure-matched control to separate part of the effect of lower risky exposure from the momentum gate itself.
Exposure-matched control
At each rebalance, α_t is the sum of H001 target weights. The control scales the baseline inverse-volatility portfolio by α_t and holds the remainder in cash. Average H001 target ETF exposure is 65.186%. The maximum target-exposure difference between H001 and the control is 0.000000 percentage points.
Realized daily exposures can diverge after a rebalance because the portfolios hold different assets and weights drift differently. The control equalizes target risky allocation, not realized risk, factor exposure or transaction costs.
Cost sensitivity
Transaction costs are charged on gross traded ETF notional and evaluated at 0, 5, 10 and 20 bps. The main risk-adjusted pattern remains present across those scenarios. At 10 bps, H001 has higher Sharpe and smaller maximum drawdown than both baseline and exposure-matched control.
| Strategy | CAGR | Volatility | Sharpe | Max drawdown |
|---|---|---|---|---|
| Baseline | 5.199% | 8.739% | 0.459 | −25.958% |
| Exposure-matched | 4.416% | 5.467% | 0.555 | −13.894% |
| H001 | 4.891% | 5.402% | 0.645 | −11.009% |
Primary results use 10 bps per unit of gross ETF notional traded. The fully invested baseline has the highest historical CAGR.
ROBUSTNESS AND REPRODUCIBILITY
Descriptive robustness, not statistical proof.
The strategy is evaluated over four predefined subperiods and a nine-combination parameter grid. These are overlapping historical experiments, not independent evidence.
Subperiods
H001 exceeds the exposure-matched control in CAGR and Sharpe in three of the four periods. The main exception is 2018–2022, where the matched portfolio has higher CAGR and Sharpe while H001 retains the smaller maximum drawdown.
Parameter grid
The grid evaluates volatility windows of 40, 60 and 90 sessions and momentum lookbacks of 189, 252 and 315 sessions. Across all nine combinations, H001 has higher CAGR, higher Sharpe and smaller maximum drawdown than its corresponding exposure-matched control. The original 60/252 specification remains fixed; the grid is descriptive, not a parameter-selection exercise.
Evaluation sample after all specifications complete initial deployment: 2008-05-02 to 2026-09-30, 4,632 observations.
Reproducibility
- ETF snapshots: Tiingo adjusted prices; FRED DGS3MO as cash-rate proxy; requested range 2007-01-01 to 2026-09-30.
- Published snapshots contain 4,967 common trading sessions from 2007-01-03 through 2026-09-30.
- The loader requires all ETF snapshots to share exactly the same observed-session calendar and rejects incomplete terminal snapshots.
results/h001/data_manifest.jsonrecords requested and actual date ranges, row counts, SHA-256 hashes, data conventions, retrieval metadata and versions.- Environment lockfile records direct-package versions; tests cover accounting, timing, exposure matching and an end-to-end pipeline.
- Test result: 35 passed. GitHub Actions tests Python 3.11 and 3.13.
LIMITATIONS AND SOURCE
Historical research, not a deployable trading claim.
The repository states its assumptions and limits publicly. Sharpe and CAGR are historical descriptive results, not expected future returns.
- Retrospective ETF-universe selection.
- No pristine untouched out-of-sample dataset.
- No formal claim that parameter variants are statistically independent.
- Simplified conversion of Treasury yields into daily cash returns.
- Constant proportional transaction costs; no bid-ask spread or explicit market-impact model.
- Dependence on adjusted-price data supplied by the provider.
- The exposure-matched control equalizes target risky allocation, not realized risk or factor exposure.
- Further work should prioritize genuinely prospective validation.
LINKS
Source and experiment
CONTACT
Have a hard problem?
Let's make it measurable.
Open to AI Engineer, Applied ML and Software Engineer roles where evaluation and engineering judgment matter as much as model choice. Based in Madrid.
Open to AI Engineer, Applied ML and Software Engineer roles