Hedge Fund Blueprint
Build, plan, review, or extend a systematic hedge fund or trading operation, including data storage, backtesting, risk modeling, signal generation, portfolio optimization, execution, and operations. The skill provides a structured approach to assembling the full trading loop from data to results.
Editor's Note
Before starting, ensure that the data store (Build 01) can rebuild any past day exactly, including the universe. This is a prerequisite for all subsequent builds. Additionally, use the 'start with' column until a limit is measured (e.g., data size or processing speed), then move to the 'at scale' column.
When to Use It
- Building a hedge fund or trading system from scratch
- Deciding what to build next in a trading stack
- Reviewing or extending an existing hedge fund platform
- Validating whether a backtester, risk model, or optimizer is sufficient
- Mapping the trade lifecycle from decision to settlement
- Understanding how the components of a fund fit together
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
Hedge Fund Blueprint
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.
The map
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
How to work with this skill
- Locate the project on the build sheet. Find out which builds exist and whether each gate would pass today, by reading the repo or asking. A later build that exists says nothing about an earlier one: a backtester running on data that is not point-in-time produces confident fiction.
- Work on the earliest build whose gate fails. If the request is for something later (deep learning signals with no cost-aware backtester, live trading with no reconciliation), say what is missing and what it puts at risk, offer the thin version of the prerequisite, then follow the user's decision. They may have a reason; make sure it is an informed one. One planned exception: Build 04 can stay red for a long time, because most signals fail. Builds 05, 06 and operations test machinery, not edge, so close the loop on paper with a placeholder signal marked "not approved" and keep reporting 04 as failing. A thin loop that runs daily beats a perfect layer with nothing downstream of it.
- Use the "start with" column until a limit is measured: data too large, solve too slow, researchers blocked. The "at scale" column is where funds end up after years, and reaching for it early is the most common way a fund project never trades.
- Wire the gate to their data and report its output. The functions in
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. - Read the reference for the layer in hand before designing it (table below).
Build sheet
| # | 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.
Contracts between the layers
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 |
One trade, start to finish
| 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.
The three equations that run it
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.
What goes wrong
| 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 |
References
| 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 |
Scope
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.
View original Markdown
---
name: hedge-fund-blueprint
description: Use when building, planning, reviewing or extending the platform of a systematic (quant) hedge fund or trading operation as a whole - point-in-time data store, backtester, factor risk model, signals, portfolio optimizer, execution and order management, reconciliation, P&L attribution - or when deciding what to build first, which stack to start with, or whether one of those pieces is finished. Triggers - "build a hedge fund / quant fund / trading system from scratch", "what should I build next", research-to-production pipeline, alpha platform architecture, "is my backtester / risk model / optimizer good enough", trade lifecycle from decision to settlement, how the parts of a fund fit together. Use it even when only one piece is named but the user is clearly assembling the full loop.
---
# Hedge Fund Blueprint
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.**
## The map
```
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
```
## How to work with this skill
1. **Locate the project on the build sheet.** Find out which builds exist and
whether each gate would pass today, by reading the repo or asking. A later
build that exists says nothing about an earlier one: a backtester running on
data that is not point-in-time produces confident fiction.
2. **Work on the earliest build whose gate fails.** If the request is for
something later (deep learning signals with no cost-aware backtester, live
trading with no reconciliation), say what is missing and what it puts at
risk, offer the thin version of the prerequisite, then follow the user's
decision. They may have a reason; make sure it is an informed one.
One planned exception: Build 04 can stay red for a long time, because most
signals fail. Builds 05, 06 and operations test machinery, not edge, so close
the loop on paper with a placeholder signal marked "not approved" and keep
reporting 04 as failing. A thin loop that runs daily beats a perfect layer
with nothing downstream of it.
3. **Use the "start with" column** until a limit is measured: data too large,
solve too slow, researchers blocked. The "at scale" column is where funds
end up after years, and reaching for it early is the most common way a fund
project never trades.
4. **Wire the gate to their data and report its output.** The functions in
`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.
5. **Read the reference for the layer in hand** before designing it (table below).
## Build sheet
| # | 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.
## Contracts between the layers
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 |
## One trade, start to finish
| | 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`.
## The three equations that run it
**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.
## What goes wrong
| 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 |
## References
| 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 |
## Scope
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.
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.