Contract
- Input: factor concept and universe definition.
- Output: Markdown backtest artifact.
- Side effects: none.
- Dependencies: none.
- Stop condition: artifact complete with verdict.
- Risk: low.
- Boundary: reasoning and optional code; no system changes.
Quant Factors
Build a factor — a signal that explains cross-sectional returns — and test it with discipline. A factor without a robust test is a story.
When to use
- The user wants to construct, validate, or critique an investment factor.
- A trading strategy needs its alpha source decomposed.
- An existing backtest needs the "is this real?" sanity pass.
Process
1. Define the signal
State the factor in one sentence: f(asset) → score. Examples: trailing-12-month return (momentum), book-to-price (value), term-spread (carry).
Specify:
- Universe — what assets are eligible (equities, futures, FX pairs, crypto).
- Rebalance frequency — daily / weekly / monthly.
- Lookback — explicit window; no implicit defaults.
- Score direction — long top, short bottom, or long-only.
Completion criterion: signal, universe, rebalance, lookback, direction all stated.
2. Handle data honestly
- Survivorship bias: use a point-in-time dataset; delisted names kept.
- Look-ahead bias: features computed only on data available at decision time.
- Corporate actions: splits, dividends, mergers adjusted consistently.
- Missing data: explicit policy (drop, fill, cap).
Completion criterion: each bias named and the mitigation is in code.
3. Build the backtest
Run a backtest with:
- Transaction-cost model — not zero. Commissions + spread + market impact estimate.
- Position sizing — equal weight, inverse-vol, or factor-weighted.
- Benchmark — explicit (e.g. cap-weighted universe, risk-free, SPY).
- Out-of-sample split — train / test / walk-forward, not just one backtest window.
Completion criterion: backtest code runs; out-of-sample period exists and is honoured.
4. Stress tests
Attack the signal:
- Subperiods: does it survive across decades / regimes (2008, 2020, 2022)?
- Sectors / geographies: is the effect localised to one slice?
- Turnover: annualised; high turnover often eats alpha.
- Capacity: does Sharpe decay as AUM grows (impact model)?
- Crowding: is the factor correlated with known crowded trades?
Completion criterion: each stress test reported, even if the answer is "passed".
5. Statistics
Report with discipline:
- Sharpe, Sortino, max drawdown, Calmar.
- t-stat of alpha vs benchmark, not just raw return.
- Information ratio if it's an active strategy.
- p-values and multiple-testing correction if many variants were tried.
Completion criterion: Sharpe, drawdown, t-stat (or alpha) all present; multiple-testing acknowledged.
6. Deliver
Markdown artifact with: signal definition, biases mitigated, backtest setup, stress tests, statistics, and a verdict — "robust", "weak", "fragile", or "fails".
Completion criterion: artifact present; verdict is honest and grounded in the numbers, not in narrative.
1---2name: quant-factors3description: Define, test, and stress-test a quantitative factor (momentum, value, carry, quality) with explicit universe, signal, weighting, and statistical checks.4---56## Contract78- **Input:** factor concept and universe definition.9- **Output:** Markdown backtest artifact.10- **Side effects:** none.11- **Dependencies:** none.12- **Stop condition:** artifact complete with verdict.13- **Risk:** low.14- **Boundary:** reasoning and optional code; no system changes.15---1617# Quant Factors1819Build a **factor** — a signal that explains cross-sectional returns — and test it with discipline. A factor without a robust test is a story.2021## When to use2223- The user wants to construct, validate, or critique an investment factor.24- A trading strategy needs its alpha source decomposed.25- An existing backtest needs the "is this real?" sanity pass.2627## Process2829### 1. Define the signal3031State the factor in one sentence: *f(asset) → score*. Examples: trailing-12-month return (momentum), book-to-price (value), term-spread (carry).3233Specify:3435- **Universe** — what assets are eligible (equities, futures, FX pairs, crypto).36- **Rebalance frequency** — daily / weekly / monthly.37- **Lookback** — explicit window; no implicit defaults.38- **Score direction** — long top, short bottom, or long-only.3940**Completion criterion:** signal, universe, rebalance, lookback, direction all stated.4142### 2. Handle data honestly4344- **Survivorship bias:** use a point-in-time dataset; delisted names kept.45- **Look-ahead bias:** features computed only on data available at decision time.46- **Corporate actions:** splits, dividends, mergers adjusted consistently.47- **Missing data:** explicit policy (drop, fill, cap).4849**Completion criterion:** each bias named and the mitigation is in code.5051### 3. Build the backtest5253Run a backtest with:5455- **Transaction-cost model** — not zero. Commissions + spread + market impact estimate.56- **Position sizing** — equal weight, inverse-vol, or factor-weighted.57- **Benchmark** — explicit (e.g. cap-weighted universe, risk-free, SPY).58- **Out-of-sample split** — train / test / walk-forward, not just one backtest window.5960**Completion criterion:** backtest code runs; out-of-sample period exists and is honoured.6162### 4. Stress tests6364Attack the signal:6566- **Subperiods:** does it survive across decades / regimes (2008, 2020, 2022)?67- **Sectors / geographies:** is the effect localised to one slice?68- **Turnover:** annualised; high turnover often eats alpha.69- **Capacity:** does Sharpe decay as AUM grows (impact model)?70- **Crowding:** is the factor correlated with known crowded trades?7172**Completion criterion:** each stress test reported, even if the answer is "passed".7374### 5. Statistics7576Report with discipline:7778- **Sharpe**, **Sortino**, **max drawdown**, **Calmar**.79- **t-stat of alpha** vs benchmark, not just raw return.80- **Information ratio** if it's an active strategy.81- **p-values** and **multiple-testing correction** if many variants were tried.8283**Completion criterion:** Sharpe, drawdown, t-stat (or alpha) all present; multiple-testing acknowledged.8485### 6. Deliver8687Markdown artifact with: signal definition, biases mitigated, backtest setup, stress tests, statistics, and a **verdict** — "robust", "weak", "fragile", or "fails".8889**Completion criterion:** artifact present; verdict is honest and grounded in the numbers, not in narrative.