/quant-skills:hedge-fund-blueprintfrom quant-skills
Guides building a systematic quant hedge fund platform: data store, backtester, risk model, signals, optimizer, execution, reconciliation, P&L attribution. Helps decide build order and when a component is production-ready.
Ships in quant-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A quant fund is one loop: data feeds research, research approves signals, production trades them, operations measures what happened, and those results choose the next idea. The loop makes money; no single layer does.
Build the loop first, thin, one layer at a time, in the order of the build sheet. A build is done when its gate passes on real data. Then run the loop every day and let the results choose the next idea.
DATA market data -> fundamentals -> alt data -> point-in-time store
what was known | as-of data
v
RESEARCH idea queue -> feature pipeline -> backtester -> signal library
what works ^ | approved signals
| v
PRODUCTION | signal blend -> risk model -> optimizer -> risk checks -> execution <-> markets
what to trade | | every order and fill
| v
OPERATIONS +-- attribution <- event log <- reconciliation <- fund admin
what happened results pick the next idea
scripts/ take plain pandas and numpy objects. Show the PASS/FAIL lines as
the evidence. Never call a build done because the code looks right.| # | Build | What it does | Start with | At scale | Done when |
|---|---|---|---|---|---|
| 01 | Data store | Every price, filing and alt dataset stored with the date it became known | Parquet files, DuckDB | kdb+, ClickHouse | Any past day rebuilds exactly, universe included |
| 02 | Backtester | Event-driven simulator with real costs, delays and partial fills | Python, Polars | Custom C++ engines | Raw data in, the same result out, every time |
| 03 | Risk model | Factor exposures, factor covariance and stock-specific risk | PCA or style factors | MSCI Barra, Axioma | Predicted volatility tracks realized volatility |
| 04 | Signals | Forecasts of return per asset over one fixed horizon | Ridge, gradient boosting | Deep learning on GPU clusters | Edge survives costs on data the model never saw |
| 05 | Optimizer | Forecasts into target weights under risk limits and costs | cvxpy | MOSEK, Gurobi | Risk and turnover stay inside their limits |
| 06 | Execution | Order system, broker connection and pre-trade risk checks | Broker API, paper account | In-house OMS, FIX to many brokers | Paper fills match the backtest's cost estimate |
The order is a dependency chain. The backtester needs as-of data. Signals can only be judged in a backtester that charges costs. The optimizer needs a risk model and forecasts. Execution closes the loop by checking the cost assumptions that every earlier step relied on.
Gate for each build, all in scripts/:
| Build | Gate function | What it checks |
|---|---|---|
| 01 | pit.gate_data_store | two clocks on every fact, no overwrites, restatements leave old snapshots unchanged, stored digests match, delisted names kept |
| 02 | backtest.gate_backtester | two runs identical; scrambling the future leaves the past unchanged; costs charged; oversized orders partly filled |
| 03 | risk_model.gate_risk_model | out-of-sample bias statistic near 1 across test portfolios |
| 04 | signals.gate_signal | positive out-of-sample IC, positive edge after costs, deflated Sharpe for the number of variants tried |
| 05 | optimizer.gate_optimizer | predicted volatility and turnover inside limits; no trade when the forecast does not pay its cost |
| 06 | execution.gate_execution | log replays to the live book; oversized order rejected; kill switch works; paper cost within tolerance of the backtest |
| Ops | operations.gate_operations | book matches broker; planted break caught; attribution sums to the day's return |
python scripts/run_gates.py, run from this skill's folder, executes all of them
on a synthetic market in about 20 seconds. It needs numpy, pandas and cvxpy. Use it to see how each gate is called,
then copy the modules into the project and point the gates at real data. The demo
passing proves the reference code works, nothing about the user's fund.
Each arrow on the map is a contract. Most broken funds broke one of these.
| Contract | Rule | What breaks without it |
|---|---|---|
| As-of data | research and production read only through as-of queries | backtests trade on numbers nobody had yet |
| Same code as live | a feature is one function of an as-of snapshot, used by both | live behavior drifts from what was tested |
| One forecast | signals are return forecasts over one fixed horizon, blended into one number per asset | the optimizer cannot weigh forecast against cost |
| One risk model | optimizer, risk checks and attribution share the same B, F, D | three risk numbers for one book |
| Pre-trade limits | every order passes independent risk checks | one bad forecast or price becomes a large position |
| Append only | every order and fill goes to a replayable event log | no audit trail, no recovery, no honest attribution |
| Results pick ideas | attribution re-ranks the idea queue | research follows taste instead of evidence |
| Step | What happens | |
|---|---|---|
| Trade date | 1 Decide | optimizer sets the target, the OMS builds the orders |
| 2 Check | risk and compliance approve each order | |
| 3 Execute | algos work it into fills | |
| 4 Allocate | fills split by fund, confirmed with the broker | |
| 5 Clear | a clearinghouse nets and guarantees the trades | |
| Settlement | 6 Settle | cash and securities change hands |
| 7 Reconcile | books matched to broker and administrator |
Steps 1 to 3 are the system you build; 4 to 7 are where it meets counterparties,
and where money is lost quietly. Details and settlement cycles in
references/operations.md.
Optimizer
w* = argmax_w mu'w - (lambda/2) w' Sigma w - kappa' |w - w0|
mu is the blended forecast, Sigma the risk model, lambda the risk appetite,
kappa the cost per unit traded, w0 the current book. A trade happens only
when its forecast pays for its cost. Keep all three terms in the same units over
the same horizon, or the book either never trades or never stops.
Risk model
Sigma = B F B' + D
Exposures B, factor covariance F, stock-specific risk D. For 3,000 stocks
and 60 factors that is 184,830 numbers to estimate instead of 4,501,500. Use it
in factor form; never build the dense matrix in production.
Position scale
k = sigma_target / sigma_predicted
Scale the whole book to a risk target. Aim for 10% volatility with a forecast of
8% and every position grows by k = 1.25. Cap k, and check that position and
turnover limits still hold after scaling.
| Symptom | Usual cause | Fix |
|---|---|---|
| Backtest Sharpe above 3 on daily equity data | look-ahead, survivorship or missing costs | run gates 01 and 02 before believing anything |
| Great in research, flat live | research and live features are two implementations | one feature function, parity test in CI |
| Dozens of signals, none holds up | many variants tried, the best one reported | log every trial, apply the deflated Sharpe |
| Optimizer piles into a few names | noisy covariance matrix or forecasts in the wrong units | factor model, forecasts as IC x vol x score, position limits |
| Book churns every day | cost term missing, quadratic, or on a different horizon from the forecast | L1 cost in the objective, matched horizons |
| Live costs far above backtest | cost model never calibrated on real fills | Build 06 gate, then recalibrate |
| P&L nobody can explain | no attribution, or a different risk model in each place | one risk model, daily attribution |
| Months of infrastructure, no trades | building the "at scale" column first | thin loop first, deepen the layer that measurements say is weakest |
| Read | When |
|---|---|
references/data.md | point-in-time schema, known_at per data type, universe, corporate actions, DuckDB queries |
references/research.md | idea queue, feature pipeline, backtester design, validation protocol, signal library |
references/production.md | signal blend, risk model estimation, optimizer details, risk checks, execution |
references/operations.md | trade lifecycle, event log, reconciliation, attribution, fund administrator, daily schedule |
This is an engineering blueprint. Trade on paper until every gate passes on real data. Running money for others also needs a legal structure, registration, an administrator, an auditor, a prime broker and a compliance program; those need qualified professionals in the fund's jurisdiction. Nothing here is investment advice or a promise that a strategy is profitable.
evals/builds-portfolio-construction-step/case.yaml (opens in a new tab)evals/builds-portfolio-construction-step/files/book.csv (opens in a new tab)evals/builds-portfolio-construction-step/files/returns.csv (opens in a new tab)evals/builds-portfolio-construction-step/graders/01-scales-scores-into-return-forecasts.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/02-uses-factor-or-shrunk-risk-model.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/03-has-linear-trading-cost-term.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/04-targets-are-dollar-neutral-and-capped.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/05-turnover-is-inside-limit.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/06-predicted-vol-is-inside-target.md (opens in a new tab)evals/builds-portfolio-construction-step/graders/07-states-consistent-units.md (opens in a new tab)evals/builds-portfolio-construction-step/place-files.sh (opens in a new tab)evals/builds-portfolio-construction-step/prompt.md (opens in a new tab)evals/plans-build-order-for-solo-fund/case.yaml (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/01-puts-point-in-time-store-first.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/02-orders-builds-by-dependency.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/03-gives-testable-done-criterion-per-build.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/04-starts-simple-defers-heavy-infrastructure.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/05-keeps-delisted-names-in-universe.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/06-closes-loop-with-reconciliation-and-attribution.md (opens in a new tab)evals/plans-build-order-for-solo-fund/graders/07-checks-paper-fills-against-backtest-costs.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ricko12vpl/claude-code-skills --plugin quant-skills9 skills in this plugin
/machine-learningUse when building, training, evaluating, debugging or deploying a machine learning model - tabular models with scikit-learn, XGBoost, LightGBM or CatBoost, deep learning with PyTorch, feature engineering, train/validation/test splitting, cross-validation, choosing metrics, class imbalance, hyperparameter tuning, overfitting, data leakage, probability calibration, model serving, drift monitoring. Triggers - "train a model to predict", "which model should I use", "validation score is great but production is bad", "is this data leakage", "loss is not decreasing", "tune hyperparameters", "imbalanced classes", "deploy this model", "the model got worse over time"./python-programmingUse when writing, reviewing, refactoring or debugging Python code - new modules, scripts or CLIs, type hints, dataclasses and data modelling, error handling, asyncio, pytest tests, project setup with pyproject.toml, tooling (uv, ruff, mypy, pyright), or performance work. Triggers - "write a Python function or class", "add type hints", "make this more Pythonic", "refactor this module", "why is this slow", "set up a Python project", "write tests for this", import or packaging errors, mutable default arguments, async bugs./quantitative-financeUse when working on one quantitative finance or systematic trading problem - designing or checking a backtest, testing a signal or alpha idea, time-series statistics (stationarity, cointegration, mean-reversion half-life, GARCH volatility), factor regressions, portfolio construction (mean-variance, risk parity, Black-Litterman), risk measures (volatility, VaR, expected shortfall, drawdown), position sizing and Kelly, execution schedules, market impact, transaction cost analysis, or computing and interpreting performance numbers such as a Sharpe ratio. Triggers - pairs trading, momentum or mean-reversion strategies, walk-forward optimization, overfitting or look-ahead worries, slippage, order book analysis, "is this result real". For assembling a whole fund platform in build order, use hedge-fund-blueprint./senior-quantitative-developerUse when building, optimizing or hardening trading infrastructure - market data feed handlers, order gateways and routing, pre-trade risk, low-latency hot paths, tick capture and replay - or when the work concerns latency percentiles (P50, P99), jitter, throughput, packet loss, sequence gaps, deterministic recovery, lock-free queues, kernel bypass, clock synchronisation, or production readiness of a trading system (observability, canary release, rollback, incident response). Triggers - "reduce feed handler latency", "tick to trade", "why did P99 spike", "handle exchange gaps", FIX, ITCH, OUCH, kill switch, backpressure./senior-quantitative-researcherUse when researching, validating or documenting a trading signal or systematic strategy to an institutional standard - forming and pre-registering a hypothesis, building features without leakage, walk-forward or purged cross-validation, ablations and sensitivity analysis, capacity and cost modelling, writing a research report, preparing a signal for handover to production, or diagnosing why live results differ from the backtest. Triggers - "alpha research", "is this signal real", "validate my strategy", "factor research", "research memo", "live vs backtest gap", "alpha decay", "how much capital can this take"./senior-quantitative-traderUse when making portfolio-level decisions for a systematic book - allocating risk across strategies or signals, sizing and leverage, hedging factor or market exposure, setting and applying drawdown rules, reviewing performance attribution (alpha versus factor versus cost), deciding whether to scale, cut, pause or retire a strategy, or writing a periodic performance review or decision memo. Triggers - "attribution review", "how much risk should each strategy get", "we are in drawdown, what now", "should we scale this up", "hedge the beta", "risk budget", "quarterly review", "is this strategy broken or unlucky".Other plugins' skills for the same job