Source confidence: high

Quant Project Ideas — 15 Projects Worth Building

In short: A curated, opinionated list of quant projects — skewed toward the ones that actually teach you something and give you a tool you'll keep using.

Key fact Detail
What it covers agents, data science, finance/trading
Posts covered 1 post (1 A-tier) · top: 10 non-cliche quant research projects…
Sources dated Jan 2026
Prompt system Run-it-yourself prompts
Last verified 2026-10-22

A curated, opinionated list of quant projects — skewed toward the ones that actually teach you something and give you a tool you'll keep using. The seed for this list is a Twitter thread credited to @heidioftheeast with ideas like probability of backtest overfitting, Bayesian Black-Litterman, Ornstein-Uhlenbeck, and Kalman filters. I have expanded it with adjacent projects that round out a real quant portfolio, and ranked by build-value (difficulty × payoff × reusability across future work).

Each entry: what it is → the math in one line → a canonical repo → difficulty → why build it → how it slots into your stack.

Difficulty scale: 🟢 weekend · 🟡 1-2 weeks · 🟠 1 month · 🔴 multi-month


Tier 1 — Must-build infrastructure

These aren't strategies; they're the scaffolding every quant portfolio needs. Build them first, use them forever.

1. Probability of Backtest Overfitting (PBO) 🟡

What: Lopez de Prado / Bailey / Borwein's framework for estimating how much of a backtested Sharpe is spurious. Uses Combinatorially Symmetric Cross-Validation (CSCV) to compute PBO, performance degradation, and related statistics (Probabilistic Sharpe Ratio, Minimum Track Record Length, Deflated Sharpe Ratio).

Math: Split your N-column return matrix of N strategy variants into S submatrices, enumerate all C(S, S/2) train/test splits, and compute the fraction of splits where the in-sample-best strategy underperforms median out-of-sample. That fraction is PBO.

Repo: esvhd/pypbo — reference Python implementation with PBO, PSR, MinTRL, DSR.

Difficulty: 🟡 1-2 weeks to understand and integrate.

Why build it: Because every backtest you'll ever run is at risk of being overfit and you currently have no number for how much. The difference between a strategy with PBO=0.10 and PBO=0.60 is the difference between "ship it" and "throw it out" — and without this you are guessing.

Plugs into your stack: Direct gate for the challenge-game tournament flow. Any ensemble that emerges from /challenge-game should pass a PBO check before promotion to paper-trading. Specifically the Phase 12 Oracle Commander finding (rolodex WR overfit) is the exact failure mode PBO detects. This is arguably the single highest-leverage tool on this whole list for you.


2. Walk-Forward + Purged K-Fold CV Harness 🟡

What: Cross-validation that respects time ordering and purges look-ahead leakage. Lopez de Prado's Purged K-Fold leaves a gap between train and test to prevent label leakage from overlapping samples.

Math: Standard K-fold but with an embargo: if sample i is in the test set and sample j in train shares any information window with i, drop j. Purging removes samples whose labels span the test period.

Repo: hudson-and-thames/mlfinlab — implements Purged K-Fold, Combinatorial Purged CV, and the rest of Advances in Financial Machine Learning.

Difficulty: 🟡 1-2 weeks.

Why build it: Regular sklearn cross-validation is subtly wrong for financial data. Purged K-Fold fixes it.

Plugs into your stack: Pair with PBO in the challenge-game validation gate. Use for all ML-layer training in Oracle Commander / Rolodex.


3. Research Infrastructure: bar sampling, labeling, feature engineering 🟠

What: Dollar bars instead of time bars, triple-barrier labeling, fractional differentiation for stationarity without losing memory. All from the first chapters of Advances in Financial Machine Learning.

Math: Dollar bars sample whenever cumulative traded dollar volume crosses a threshold (better sampling distribution than time bars). Triple-barrier labels each observation as +1/-1/0 depending on which horizon / SL / TP barrier hits first. Fractional differentiation: (1 − L)^d with non-integer d preserves long memory while achieving stationarity.

Repo: hudson-and-thames/mlfinlab (same).

Difficulty: 🟠 1 month to absorb end-to-end.

Why build it: Time-bar OHLCV is what every retail trader uses and every professional abandoned a decade ago. The research gap is real.

Plugs into your stack: Rebuild the trading-agent-team feature pipeline on dollar bars — the fast-cycler and graduated-TP strategies will almost certainly look different (and probably better) when fed cleaner inputs.


Tier 2 — Classical quant strategies with real math

4. Ornstein-Uhlenbeck Pairs Trading 🟡

What: Fit an OU mean-reverting process to the spread between two cointegrated assets. Trade the spread when it deviates from its long-run mean. The classic stat-arb setup.

Math: OU process dX_t = θ(μ − X_t) dt + σ dW_t. Fit θ, μ, σ via maximum likelihood on the discretized residuals of a cointegrating regression Y = α + β X + ε. Trade when |residual − μ| > k · σ, exit at mean. Half-life of mean reversion is ln(2) / θ.

Repo: david-alber/Pairs-Trading-as-application-to-the-Ornstein-Uhlenbeck-Process and cantaro86/Financial-Models-Numerical-Methods (the OU notebook is particularly clean).

Difficulty: 🟡 1-2 weeks.

Why build it: It's the canonical example for learning how to turn a stochastic differential equation into a trading rule. After you've done it once, half the academic literature opens up.

Plugs into your stack: Crypto pairs (e.g., ETH/BTC perp spread, or HYPE/SOL correlation) are great OU candidates on Hyperliquid. Add as a new sub-strategy — uncorrelated with the directional fast-cyclers.


5. Kalman Filter Dynamic Hedge Ratio 🟡

What: Instead of fitting a fixed cointegration coefficient β from OLS, let β drift over time via a Kalman filter. Adapts pairs-trading to regime changes.

Math: State-space model where β_t is the latent state with a random walk prior, observation equation y_t = β_t x_t + ε_t. Standard Kalman update gives a time-varying posterior mean of β_t that adapts on every new observation.

Repo: msekatchev/kalman-filter-asset-prices and QuantConnect/Research Kalman Filter Based Pairs Trading notebook.

Difficulty: 🟡 1-2 weeks.

Why build it: Kalman filters are one of the few pieces of math every practitioner uses and every textbook explains badly. Pairs trading is the clearest use case to actually grok them.

Plugs into your stack: Generalizes OU pairs from #4. Also useful as a smoother for any noisy signal — rolling Hawkes branching ratio, funding rate imbalance, OI momentum. The filter is a reusable primitive beyond pairs trading.


6. Bayesian Black-Litterman Portfolio Allocation 🟠

What: Black-Litterman blends market-implied equilibrium returns with the investor's subjective views into a posterior distribution of expected returns. The "Bayesian" version treats it properly as a conjugate-normal Bayesian update instead of the classical BL closed form, letting you express non-Gaussian views and uncertainty.

Math: Prior: π ~ N(Π, τ Σ) where Π is reverse-optimized from market weights. Views: P μ = Q + ε, ε ~ N(0, Ω). Posterior: μ | views ~ N(μ̂, Σ̂) with

μ̂ = [(τΣ)⁻¹ + P' Ω⁻¹ P]⁻¹ [(τΣ)⁻¹ Π + P' Ω⁻¹ Q]

PyMC version lets you specify full posteriors on views.

Repos:

Difficulty: 🟠 1 month if you're doing the full Bayesian version in PyMC.

Why build it: It's the canonical way to combine a strategy's signal ("I think BTC has +5% expected return next week") with market-neutral portfolio math. Most retail approaches ignore covariance entirely; this teaches you to respect it.

Plugs into your stack: Position-sizing layer for the multi-coin trading-agent-team. Current approach is mostly equal-weight across 8 coins — BL would let each sub-strategy express its own "view" on a coin's expected return and the portfolio optimizer would blend them with the correlation matrix. Cleanest upgrade path to proper risk-parity allocation.


7. Deflated Sharpe Ratio + Probabilistic Sharpe Ratio 🟢

What: Already partially covered in #1 via pypbo, but worth doing as a standalone. PSR tells you the probability that an observed Sharpe is above a threshold; DSR corrects for multiple testing (how many strategies you tried before finding this one).

Math: PSR = Φ[(SR̂ − SR*) · √(T − 1) / √(1 − γ_3 · SR̂ + (γ_4 − 1)/4 · SR̂²)] where γ_3, γ_4 are skew and kurtosis of returns. DSR replaces SR* with an effective threshold derived from the number of trials.

Repo: esvhd/pypbo ships PSR and DSR alongside PBO.

Difficulty: 🟢 weekend.

Why build it: Any time you report a Sharpe ratio without its confidence interval and multiple-testing correction, you're misleading yourself and anyone you show it to.

Plugs into your stack: Mandatory reporting field for every challenge-game tournament output.


Tier 3 — Market microstructure

8. Avellaneda-Stoikov Market Maker 🟡

What: Closed-form optimal bid-ask quoting as a function of inventory, volatility, and risk aversion.

Math: See avellaneda-stoikov-and-hawkes.md for the full treatment. Reservation price r = s − qγσ²(T−t), half-spread = (γσ²(T−t) + (2/γ) ln(1 + γ/k)) / 2.

Repo: fedecaccia/avellaneda-stoikov — cloned to repos/avellaneda-stoikov/.

Difficulty: 🟡 1-2 weeks (more to productionize).

Why build it: It's the canonical market-making model. Any future conversation about liquidity provision starts from here.

Plugs into your stack: Maker leg on Hyperliquid. Full integration story in avellaneda-stoikov-and-hawkes.md.


9. Hawkes Process Order Flow Model 🟠

What: Self-exciting point process fit to trade timestamps. Captures order-flow clustering, provides a regime detector via branching ratio, and gives a short-horizon intensity forecast.

Math: λ(t) = μ + Σ_{t_i < t} α · exp(−β (t − t_i)), stable iff α/β < 1.

Repo: x-datainitiative/tick for fitting, jeremymck/High-Frequency-Data---Limit-Order-Books for education.

Difficulty: 🟠 1 month to do well (fitting is finicky, kernel choice matters).

Why build it: Because Poisson is wrong and everyone pretends otherwise. Hawkes is the simplest upgrade that actually describes real order flow.

Plugs into your stack: Regime filter + feature for the existing taker strategies. Full story in avellaneda-stoikov-and-hawkes.md.


10. Order Flow Imbalance (OFI) Signal 🟡

What: A single scalar computed from L2 order-book updates that predicts short-horizon price moves. Cont, Kukanov, Stoikov (2014) show OFI linearly predicts mid-price changes at ~1-10 second horizon with high R².

Math: OFI_t = Σ (ΔBidSize_t · 1[ΔBid ≥ 0] − ΔAskSize_t · 1[ΔAsk ≤ 0]) — signed flow into bids minus flow into asks, over a short window. Aggregated at the top of book or across levels.

Repo: No single canonical Python repo; the arxiv paper Forecasting high frequency order flow imbalance using Hawkes processes has reference code. Easy to write from scratch in ~50 lines.

Difficulty: 🟡 1-2 weeks (including getting L2 data wired up).

Why build it: Highest-R² linear predictor of short-horizon price movement that you can compute without any ML. If you build nothing else in microstructure, build this.

Plugs into your stack: Direct input to Oracle Commander's coin-selection logic. Use flowsurface (in ./repos/flowsurface/) as the L2 data source — it already speaks Hyperliquid.


Tier 4 — Machine learning meets trading

11. Meta-labeling / Triple Barrier + Random Forest 🟠

What: Lopez de Prado's meta-labeling. A "primary" model (e.g., a simple trend signal) generates trade direction; a "secondary" ML model predicts whether to take each of those trades. The ML learns to filter false positives rather than predict price.

Math: Primary gives side_t ∈ {-1, 0, +1}. Triple-barrier assigns each primary signal a binary label: did it hit TP before SL? Secondary model (random forest, xgboost) learns P(success | features) and you gate trades at P > threshold.

Repo: hudson-and-thames/mlfinlab meta-labeling module.

Difficulty: 🟠 1 month.

Why build it: It's the ML approach to trading that actually works in practice, because it decouples the hard problem (direction prediction) from the easier problem (quality filtering).

Plugs into your stack: Direct upgrade path for the fast-cycler strategies. Current approach is rule-based entries; meta-label them with an RF trained on order-book and funding features to filter out the losers. Preserves the deterministic execution layer per your rule (rules execute, AI advises).


12. Regime Detection via Hidden Markov Models 🟡

What: Fit a 2-4 state HMM to returns and/or volatility and use the inferred state as a regime label (risk-on / risk-off / crisis). Gate strategies on regime.

Math: HMM with Gaussian emissions, Baum-Welch EM for fitting, Viterbi for state decoding. hmmlearn in Python is the standard library.

Repo: hmmlearn/hmmlearn plus many tutorial notebooks.

Difficulty: 🟡 1-2 weeks.

Why build it: The cleanest way to express "this strategy works in some regimes and not others" — which is true for every strategy.

Plugs into your stack: Meta-layer for the ensembles. Instead of running all 10 ensembles constantly, activate subsets by regime. Crisis state → halt entirely or switch to defensive.


13. CPCV + Backtest Pipeline 🟠

What: Combinatorial Purged Cross-Validation — generate many out-of-sample Sharpe paths from a single backtest and compute confidence intervals. Goes hand-in-hand with PBO.

Math: Generate C(N, k) combinations of test folds from N total groups, each leaving k folds out. Purge and embargo overlapping samples. Run the strategy on each combination. Get a distribution of OOS Sharpes, not a point estimate.

Repo: hudson-and-thames/mlfinlab.

Difficulty: 🟠 1 month to integrate into an existing backtest framework.

Why build it: Gives you honest confidence intervals on a strategy's Sharpe. A strategy with mean Sharpe 1.5 and 5th percentile -0.2 is very different from one with mean 1.5 and 5th percentile 1.1, and a single backtest run cannot tell you which you have.

Plugs into your stack: Graduated-TP and Phase 12 validation: replace the single OOS split with CPCV to get a real confidence interval on the +98% uplift finding.


Tier 5 — Ambitious projects

14. Limit Order Book Simulator + RL Agent 🔴

What: Build a high-fidelity LOB simulator driven by Hawkes-process order arrivals, then train a reinforcement learning agent (PPO or SAC) on top of it to make markets, execute optimal-execution schedules, or take directional positions.

Math: LOB state as MDP: agent observes book state + inventory + time, acts by placing/canceling orders, receives PnL reward. Transition dynamics driven by Hawkes simulations (so order flow is realistic). SAC is the go-to algorithm — see im1235/ISAC for an AS+SAC implementation.

Repo: sohaibelkarmi/High-Frequency-Trading-Simulator, javifalces/HFTFramework, im1235/ISAC.

Difficulty: 🔴 multi-month.

Why build it: It's the modern HFT research stack. Also the clearest example of "RL for trading" that doesn't immediately overfit — the simulator is synthetic and the agent can be trained to convergence.

Plugs into your stack: Too big to plug in directly. Better as a pre-training environment for the maker-leg SAC agent in avellaneda-stoikov-and-hawkes.md idea #3.


15. Bitcoin On-Chain → Volatility Predictor 🔴

What: Transformer or LSTM predicting BTC realized volatility from on-chain features (exchange flows, whale wallets, miner behavior, stablecoin supply changes). Already exists as a reference project.

Repo: bitcoin_synthesizer — clone it to ./repos/bitcoin_synthesizer/ to compare.

Difficulty: 🔴 multi-month.

Why build it: If it works, it's a direct feed for volatility-based sizing on every crypto strategy you run.

Plugs into your stack: Already in the trading-agent-team reference repo list. The integration is volatility-based sizing: scale down trade size when predicted vol spikes.


Suggested build order (for you specifically)

If I were you and I wanted to spend the next 90 days leveling up the trading-agent-team, this is the order I'd tackle them:

  1. PBO (#1) + PSR/DSR (#7) — 1 week. Single biggest quality gate you can add right now. Directly addresses the rolodex WR overfit finding.
  2. Purged K-Fold + CPCV (#2 + #13) — 2 weeks. Gives honest confidence intervals on every existing strategy. The challenge-game outputs become trustworthy.
  3. OFI (#10) — 1 week. Cheap win, high signal, uses data you already have via flowsurface.
  4. Kalman (#5) + OU Pairs (#4) — 3 weeks. New sub-strategy, uncorrelated PnL, gateway drug to the rest of state-space modeling.
  5. Hawkes regime filter (#9) — 3 weeks. Overlay on existing strategies. Low risk, high potential upside as a gating signal.
  6. Avellaneda-Stoikov maker (#8) — 3 weeks. First maker leg on Hyperliquid, paired with Hawkes regime from step 5.
  7. Bayesian Black-Litterman (#6) — 4 weeks. Finally unify sizing across the 8 coins and 10 ensembles under one portfolio optimizer.
  8. Meta-labeling (#11) — 4 weeks. Quality filter for fast-cycler entries.

Skip or defer: the LOB simulator (#14) and on-chain volatility (#15) are both worth building eventually but neither has the payoff/complexity ratio to come first.


Meta observation

The list above is ~80% infrastructure and ~20% strategy, and that ratio is correct. Most retail quant traders build 5 strategies and 0 infrastructure, then can't tell why anything works or fails. The professional inversion is: build the validation and measurement stack first, and the strategies compose themselves on top.

PBO, purged CV, CPCV, PSR/DSR, OFI, Kalman — these are primitives. You use them forever on every future project. OU pairs, AS market making, meta-labeling — these are strategies. Each one is finite and replaceable. Spend your learning budget on the primitives.

Sources


Prompt system — run this yourself

Everything below is pasteable into Claude Code, Claude, or any agent. Use the one-shot when you want the whole result in one run; use the step prompts when you want to steer. Every step carries its own audit, and the gap audit at the end makes the agent find and fill what it missed.

Mission. Turn the 15-project quant list (seeded by @heidioftheeast's thread) into the one build that makes every later project trustworthy: a validation gate (Probability of Backtest Overfitting via CSCV, Probabilistic and Deflated Sharpe Ratios, Minimum Track Record Length, purged and embargoed cross-validation), proven against known answers, then used to judge one real strategy from the list, Ornstein-Uhlenbeck pairs with a Kalman-filter hedge ratio on Hyperliquid perps, with a paper arm and a control. Done means the gate reproduces published examples and catches planted overfitting, and the pairs strategy either passes the gate and a paper run or is rejected with numbers. No real money in this run.

1 · Deeper, not bigger

Before running anything, make the task deeper rather than larger. Ask: what would a top professional do here that I am not asking for; what is the rawest material; which methods and tools; what, other than the model or me, proves it right. Then ask for exactly that.

Rewritten prompt — ask for exactly that:

From the quant project list, do not pick a strategy first. Build the validation gate first, prove it on known answers, then use it to judge one strategy.

1. Implement in a package quantgate/: CSCV Probability of Backtest Overfitting (S=16), Probabilistic Sharpe Ratio, Deflated Sharpe Ratio with the number of trials, Minimum Track Record Length, purged K-fold with embargo, and combinatorial purged CV. Use the Bailey, Borwein, Lopez de Prado, Zhu PBO paper and the 2014 DSR paper as the specification. Check mlfinlab's license before importing it; write from the papers if it is not freely usable.
2. Prove it: reproduce the DSR paper's worked example; show 100 pure-noise strategies give high PBO and no strategy passes DSR; show a planted-signal set gives PBO near 0; match esvhd/pypbo on the same matrix; show purged CV removes the inflation plain KFold shows on overlapping labels.
3. Build OU pairs with a Kalman-filter hedge ratio on Hyperliquid perps (ETH/BTC, SOL/ETH, HYPE/SOL). Test cointegration out of sample. Include taker fees and funding.
4. Run the full parameter grid through the gate, counting every trial. Compare against static OLS beta and a flat control.
5. If it passes, run 30 days of paper trading.

No real money until the gate and paper run pass; any later pilot is capped at $500 notional, 1x leverage, and halts at a 10% drawdown. Never promise returns.

2 · One-shot prompt

ROLE: You are a quantitative researcher whose job is to stop overfit strategies from reaching capital. You build and prove the validation gate before you look at any strategy, and you assume every backtest is overfit until the gate says otherwise. No real orders in this run.

CONTEXT:
- Source list: 15 quant projects seeded by @heidioftheeast: Probability of Backtest Overfitting (PBO), walk-forward plus purged K-fold, dollar bars and triple-barrier labels, Ornstein-Uhlenbeck (OU) pairs, Kalman dynamic hedge ratio, Bayesian Black-Litterman, Deflated and Probabilistic Sharpe, and more. The guide ranks PBO as the highest-leverage tool and names the Oracle Commander rolodex win-rate overfit as the failure PBO would have caught.
- Specs: Bailey, Borwein, Lopez de Prado, Zhu (PBO via Combinatorially Symmetric Cross-Validation, CSCV); Bailey and Lopez de Prado (Deflated Sharpe Ratio, 2014; PSR and MinTRL, 2012); Advances in Financial Machine Learning (purged K-fold with embargo, combinatorial purged CV).
- Repos: esvhd/pypbo (reference implementation), hudson-and-thames/mlfinlab (check license; it moved to paid distribution), cantaro86/Financial-Models-Numerical-Methods (OU), QuantConnect/Research Kalman pairs notebook.
- Data: Hyperliquid info API candles and funding for ETH, BTC, SOL, HYPE perps.

HARD CONSTRAINTS:
- Gate before strategy. No strategy result is reported until the gate's synthetic tests pass.
- Count every trial (every parameter combination and every pair evaluated) and feed that count to DSR.
- Time-ordered splits only; embargo at least the maximum holding period.
- Fees and funding in every backtest: Hyperliquid taker fee and hourly funding from the API.
- No private key loaded, no order signed. Any later pilot: $500 notional total, 1x leverage, halt at 10% drawdown or 5 consecutive losing days, manual review to restart.
- Never state expected returns as promises.

DELIVERABLES, in order:
1. sources.md: formulas with equation references from each paper; license status of pypbo and mlfinlab.
2. quantgate/: pbo_cscv(returns_matrix, S), psr(sr, n, skew, kurt, sr_benchmark), dsr(sr, n, skew, kurt, n_trials, var_trial_sr), min_trl(...), PurgedKFold(n_splits, embargo), CombinatorialPurgedCV(n_groups, k_test). Typed, documented, unit-tested.
3. proof.md: DSR worked example reproduced; noise-set PBO; planted-signal PBO; agreement with pypbo; purged versus plain KFold leakage test. Each with numbers.
4. pairs/: cointegration screen (Engle-Granger, Johansen) on training data, OU MLE fit with half-life, Kalman hedge ratio with tuned process noise, entry and exit z-score rules, fee and funding accounting.
5. gate_run.md: full grid through the gate with trial count, PBO, DSR, PSR, MinTRL; versus static-OLS-beta and flat controls on held-out data.
6. paper/: read-only paper runner on live candles with both controls, only if step 5 passes.

GAP ANALYSIS (built in): keep gaps.md. Record formula ambiguities, library disagreements, data holes (HYPE history length), funding gaps, and how each biases results. Fill what you can; state the rest.

SELF-QUESTIONS before finishing:
- Does my DSR match the paper's worked example exactly, and which variance of trial Sharpes did I use?
- Did I count every trial, including pairs I screened out?
- Is the embargo at least the longest holding period?
- Are the pairs cointegrated out of sample, or only in the window I fit?
- Does the Kalman version beat static beta after fees, or just trade more?
- Is funding a cost or a hidden source of PnL in the result?
- How many years of data does HYPE have, and does MinTRL say that is enough?
- Would the gate have flagged the Oracle Commander rolodex result?

STOP CONDITIONS: stop at the gate. Stop early if the synthetic proofs fail (fix the gate first), or if no pair is cointegrated out of sample (report and end).

RETURN FORMAT: markdown report: Verdict (one line), Gate proofs table, Pairs screen, Gate run versus controls table, Paper status, Gaps ranked, file paths.

3 · Step-by-step prompts

Step 1 — Ground truth: papers, formulas, licenses

Goal: Pin every formula and dependency to its primary source.

Obtain the PBO paper (Bailey, Borwein, Lopez de Prado, Zhu), the Deflated Sharpe Ratio paper (Bailey and Lopez de Prado, 2014), and The Sharpe Ratio Efficient Frontier (2012). Extract into sources.md, with equation numbers: the CSCV algorithm (split T x N matrix into S row-blocks, all C(S, S/2) combinations, logit of the out-of-sample relative rank of the in-sample best, PBO as the fraction of logits at or below zero); PSR including skewness and kurtosis terms; DSR's expected maximum Sharpe under N trials; MinTRL. Record each paper's worked numerical examples so step 2 can reproduce them.

From Advances in Financial Machine Learning, record purged K-fold and embargo definitions and combinatorial purged CV.

Check licenses and installability: pip install pypbo or install from esvhd/pypbo; check hudson-and-thames/mlfinlab's current license and whether pip install works without a paid key. Record results. List Hyperliquid info API endpoints for candleSnapshot and fundingHistory with limits.

Expect: sources.md with formulas, equation references, worked examples, license table, API endpoint table.

Audit before moving on: Every formula has a paper and equation reference; any reconstructed from memory is marked unverified. If mlfinlab is not freely usable, mark purged CV as build-from-book in step 3.

Step 2 — Gate core: PBO, PSR, DSR, MinTRL with proofs

Goal: Implement the statistics and prove them against known answers.

Implement in quantgate/stats.py: pbo_cscv(R: ndarray[T, N], S: int = 16, metric=sharpe) returning pbo, logits, and performance degradation slope; psr(sr, n, skew, kurt, sr_benchmark=0); dsr(sr, n, skew, kurt, n_trials, var_trial_sr); min_trl(sr, skew, kurt, sr_benchmark, prob=0.95). Use non-annualized per-period Sharpe internally; annualize only in reports.

Proofs, written to proof.md with numbers: (a) reproduce the DSR paper's worked example to 3 decimals; (b) N=100 pure-noise strategies, T=2000, seeds 0-19: report the PBO distribution and confirm no strategy passes DSR at 0.95; (c) planted signal: one strategy with true per-period Sharpe 0.1 among 99 noise strategies: PBO near 0 and DSR passes; (d) run pypbo on the same matrices and report agreement to 2 decimals or explain differences; (e) hypothesis property tests: PBO in [0, 1], PSR monotone in sr, DSR decreasing in n_trials.

Expect: quantgate/stats.py, tests passing, proof.md with five numbered results and tables.

Audit before moving on: Fail if the DSR example does not reproduce; locate the discrepancy (variance of trials, Euler-Mascheroni term, kurtosis convention) before moving on. Fail if pure noise yields low PBO; check the logit sign and rank convention.

Step 3 — Purged and combinatorial cross-validation

Goal: Provide leakage-free splits and prove they remove leakage.

Implement quantgate/cv.py: PurgedKFold(n_splits, embargo_frac) taking a pandas Series of label end times (t1) indexed by start time, yielding train and test indices with training samples whose label interval overlaps the test interval removed and an embargo after each test block; CombinatorialPurgedCV(n_groups, k_test) yielding all C(n_groups, k_test) splits and a method to assemble backtest paths. Follow the book's definitions recorded in sources.md.

Leakage proof: generate a synthetic series with triple-barrier-style labels spanning 20 bars and features that are noise but share label windows with neighbors. Train a RandomForestClassifier with sklearn KFold (shuffled) versus PurgedKFold. Plain KFold should show accuracy clearly above 0.5; purged should be near 0.5. Report both with 10 seeds. Add unit tests: no train index overlaps any test label window; embargo honored; number of CPCV paths equals the formula.

Expect: quantgate/cv.py, tests passing, a leakage table in proof.md (plain versus purged accuracy, 10 seeds).

Audit before moving on: If purged accuracy is still well above 0.5 on noise, leakage remains; inspect t1 handling. Confirm the embargo length used later will be at least the maximum pairs holding period.

Step 4 — OU pairs with Kalman hedge ratio

Goal: Build the strategy from the list with honest costs.

Pull hourly candles and funding history from the Hyperliquid info API for BTC, ETH, SOL, HYPE perps, maximum available history; cache parquet. Split time: first 60% training, last 40% held out.

On training data only, screen pairs ETH/BTC, SOL/ETH, HYPE/SOL, and all other combinations with Engle-Granger and Johansen tests on log prices; record every pair tested (they count as trials). For survivors: static OLS beta, OU MLE fit on the residual spread (theta, mu, sigma, half-life ln(2)/theta). Kalman version: state beta_t (and intercept) with random-walk transition; tune process-noise delta on training only.

Rules: enter when spread z-score exceeds k, exit at z=0 or after a max hold of 3 half-lives, stop at z of 2k. Costs: Hyperliquid taker fee per leg per side, funding paid or received hourly per leg. Grid: k in {1.5, 2, 2.5}, delta in 5 values, lookback for z in 3 values. Log every combination's per-period returns as one column of the trial matrix.

Expect: pairs/ code, data cache, screen.md with all pairs tested and test statistics, a trial return matrix for the gate, held-out cointegration retest results.

Audit before moving on: Re-test cointegration on held-out data for each survivor; a pair not cointegrated out of sample is reported as failed, not dropped silently. Confirm funding is applied with the correct sign for long and short legs on 5 hand-checked hours.

Step 5 — Run the gate, compare controls, paper arm

Goal: Judge the strategy with the gate and forward evidence.

Using the trial matrix from step 4 on training data, compute PBO via CSCV with S=16. Select the in-sample best configuration. On held-out data compute its Sharpe, PSR, DSR with n_trials equal to every combination and pair evaluated, and MinTRL. Run CombinatorialPurgedCV with embargo at least the max hold to get a distribution of path Sharpes.

Controls on held-out data: static OLS beta with the same rules, and flat (no position, zero return). The strategy must beat static beta to justify the Kalman filter and beat flat after costs.

Gate: PBO below 0.2, DSR probability above 0.95, held-out Sharpe CI excluding zero, beats both controls. If and only if it passes, build paper/: a read-only runner on live hourly candles with frozen parameters, logging hypothetical fills at next-bar open plus fees and funding, alongside the static-beta control, for 30 days with a heartbeat file.

Expect: gate_run.md with PBO, DSR, PSR, MinTRL, CPCV path distribution, controls table, verdict; paper/ running only if passed.

Audit before moving on: Confirm n_trials includes screened-out pairs and every grid point. Check that no parameter was refit on held-out data. If the result passes only with the smallest trial count, it does not pass.

Step 6 — Validate against oracles, gap report

Goal: Confirm the gate is right, the verdict is earned, and list what is missing.

Run the oracles and record pass or fail with evidence: (1) DSR paper example reproduced to 3 decimals; (2) noise sets give high PBO and no DSR pass, planted signal gives near-zero PBO and passes; (3) pypbo agrees on PBO to 2 decimals or differences are explained; (4) purged CV removes the plain-KFold leakage on synthetic data; (5) the pairs verdict follows mechanically from the gate thresholds; (6) if passed, 30 days of paper trading beat the static-beta control after fees and funding. Real money stays off unless all six pass; any later pilot is capped at $500 notional, 1x leverage, 10% drawdown halt.

Apply the gate to one real past result, the Oracle Commander rolodex win-rate finding if its trial matrix is available, and report the PBO. Write gap_report.md: each guide claim (PBO highest-leverage, ETH/BTC a good OU candidate, Kalman as reusable smoother, mlfinlab as the purged CV source) and each result, verified / unverified / false with evidence, ranked by impact. Fix the top three.

Expect: oracles.md with six rows and evidence, the retro PBO on a real past result or a note on why unavailable, gap_report.md ranked.

Audit before moving on: Any oracle lacking a number or file is unverified, and an unverified oracle means no-go. Confirm no return projection appears anywhere in the reports.

4 · Gap analysis and audit

Run this after the build. It makes the agent enumerate its own claims, mark what is verified, rank the gaps and fix the top ones.

You are an independent reviewer of a quant validation gate and the pairs strategy it judged. You did not build them. Read sources.md, quantgate/, proof.md, screen.md, gate_run.md, oracles.md, and gap_report.md.

1. Enumerate every claim: formula correctness, DSR reproduction, noise and planted-signal PBO behavior, pypbo agreement, leakage removal, cointegration results, trial count, gate verdict, paper results. Mark each verified, unverified, or false. Re-run the DSR example and one noise-set PBO yourself.
2. List missing pieces: trials not counted, embargo shorter than max hold, funding sign errors, held-out data touched during tuning, small-sample HYPE history, no static-beta control.
3. Rank by impact on the chance an overfit strategy reaches capital: trial undercounting and leakage first, then cost errors, then sample size.
4. Fix the top three now and show before and after numbers.
5. Report what you could not fix and why. If any fix changes the verdict, say so first.
Return a claim table (claim, status, evidence, fix) and the ranked gap list. Never project returns.

Questions the agent must ask itself before it says done:

5 · What proves it right

6 · Failure modes

7 · Agent direction (unattended runs)

Gate first: do not touch strategy code until proof.md passes. Cache papers' formulas in sources.md and Hyperliquid data in parquet under data/quant/; never refetch cached ranges. Spawn one sub-agent to implement and test quantgate.stats against the papers and another to independently run pypbo on the same matrices as the agreement oracle. Freeze gate thresholds in code with a commit before running the strategy grid. Never load or print a private key; paper runs are read-only. Stop and ask Victor before any step that would place an order, if the synthetic proofs fail twice, or if no pair is cointegrated out of sample. Write outputs to docs/quant_gate/: sources.md, proof.md, screen.md, gate_run.md, oracles.md, gap_report.md, with code in quantgate/ and pairs/. Return the verdict line first, then the proofs table, then gaps. Never project returns.

Prompt system updated 2026-10-22 · all prompt systems · JSON