# Quantitative Finance

Use for designing or checking backtests, testing signals or alpha ideas, time-series statistics, factor regressions, portfolio construction, risk measures, position sizing, execution schedules, market impact, transaction cost analysis, and computing performance metrics like the Sharpe ratio. Applies to strategies such as pairs trading, momentum, mean-reversion, walk-forward optimization, and addressing overfitting or look-ahead bias.

**Canonical URL:** https://skillshunter.net/skills/discovered-9ab3a62cd51d8ff9da86d1de73e1637733ee050502638ea4

**JSON URL:** https://skillshunter.net/api/public/v1/skills/discovered-9ab3a62cd51d8ff9da86d1de73e1637733ee050502638ea4

**Markdown URL:** https://skillshunter.net/skills/discovered-9ab3a62cd51d8ff9da86d1de73e1637733ee050502638ea4.md

**Instructions download URL:** https://skillshunter.net/skills/discovered-9ab3a62cd51d8ff9da86d1de73e1637733ee050502638ea4/download

**Category:** Data & Research

**Source URL:** https://github.com/Ricko12vPL/claude-code-skills/blob/4bc1ba2d54dcd4ac48cef1689efd4ccb48de9c75/skills/quantitative-finance/SKILL.md

**Source commit:** 4bc1ba2d54dcd4ac48cef1689efd4ccb48de9c75

**Listing approved at:** 2026-11-29

**Created at:** 2026-11-28T18:52:30.000000Z

**Updated at:** 2026-11-29T10:53:39.000000Z

## Catalog information

The following descriptions are catalog information. Listing approval does not mean the skill has been tested or is safe for every environment.

### Editor's note

Before using this skill, ensure that all inputs are available at the time of trade placement, account for trading costs including spreads, impact, and commissions, and validate the number of versions tested to avoid overfitting. The first deliverable is typically a backtest result with performance metrics in a structured format.

### When to use it

- Designing and validating backtests for trading strategies
- Testing alpha ideas and signals for systematic trading
- Analyzing time-series statistics such as stationarity and cointegration
- Performing factor regressions and portfolio construction techniques
- Calculating risk measures like volatility, VaR, and drawdown
- Evaluating execution schedules and market impact analysis

## Skill instructions

---
name: quantitative-finance
description: Use 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.
---

# Quantitative Finance

Results in this field are wrong by default, and every common mistake errs in the
flattering direction: look-ahead, survivorship, missing costs and picking the best
of many tries all raise the Sharpe ratio. So the working stance is the reverse of
most engineering: a good result is a bug report until it has been explained.

State every result as net of costs, out of sample, on point-in-time data. When one
of those three does not hold, say which, next to the number.

## Five questions before trusting a result

Ask them in this order; the early ones invalidate everything after them.

| # | Question | Typical failure | Check |
|---|---|---|---|
| 1 | Could each input have been known when the trade was placed? | signal and return on the same bar; restated fundamentals; full-sample scaling | lag everything; scramble the future and confirm the past does not move |
| 2 | Is the universe the one that existed then? | today's index members applied to history | include delisted names with their final returns |
| 3 | What did trading cost? | zero cost, or commission only | spread + impact + commission, plus borrow and financing for shorts and leverage |
| 4 | How many versions were tried? | best of 50 variants reported as the result | count trials, apply a deflated Sharpe, keep one untouched holdout |
| 5 | How much independent evidence is there? | overlapping returns counted as separate; one regime | t-stat = Sharpe x sqrt(years); compare sub-periods |

## Conventions

| Topic | Default | Why |
|---|---|---|
| Returns | simple returns across assets, log returns across time | portfolio return is a weighted sum of simple returns; log returns add over time |
| Sharpe | arithmetic mean over standard deviation, times sqrt(periods) | using the compounded return in the numerator understates it and mixes definitions |
| Excess return | subtract the cash rate from any return that includes interest on cash or collateral; trading P&L of a dollar-neutral book that excludes that interest is already an excess return | interest earned on collateral is not skill |
| Annualizing | sqrt(252) only when daily returns are close to uncorrelated | autocorrelation makes sqrt-time scaling wrong in either direction |
| Execution | a signal from the close of day t trades no earlier than the next bar | same-bar fills are the most common look-ahead |
| Volatility | exponentially weighted, short half-life for variance | volatility clusters; flat windows react late |

## Numbers worth knowing

| Quantity | Rule | Use |
|---|---|---|
| Significance of a Sharpe | t = Sharpe x sqrt(years) | a Sharpe of 1 needs about 4 years to reach t = 2 |
| Best of N random tries | expected max Sharpe is about 2.2 standard errors at N = 50 and 2.5 at N = 100 | 50 tries on 2 years of data gives about 1.5 by luck alone |
| Fundamental law | IR is about IC x sqrt(breadth) | small edge, many independent bets |
| Score to forecast | alpha = IC x volatility x z-score | puts signals and costs in the same units |
| Half-life | -ln 2 / ln(1 + b), b from regressing the change on the lagged level | holding period for a mean-reverting spread |
| Kelly | f = mu / sigma^2, then trade a quarter to a half of it | mu is estimated, and full Kelly on an overestimate is ruinous |
| Volatility target | weight = target vol / forecast vol, capped | keeps risk steady through regimes |
| Impact | cost is about Y x daily vol x sqrt(order / daily volume) | doubling size raises cost per share by about 41% |
| Pairs screening | 100 stocks make 4,950 pairs; 5% of them pass a cointegration test by chance | require an economic link and out-of-sample stability |

## Mistakes that keep recurring

```python
# Same-bar execution: the weight uses the close it is about to earn
pnl = (weights * returns).sum(axis=1)             # wrong
pnl = (weights.shift(1) * returns).sum(axis=1)    # needs a fill at the close of t; shift(2) if the signal uses that close

# Full-sample scaling: every row sees the future mean and std
z = (x - x.mean()) / x.std()                                          # wrong
z = (x - x.expanding(60).mean()) / x.expanding(60).std()              # only the past

# Costs: turnover must be charged on the positions actually held
net = gross - held.diff().abs().sum(axis=1) * cost_bps / 1e4

# Max-Sharpe on sample means is an error maximizer: it buys whatever was luckiest.
# Use forecasts shrunk toward zero or implied returns, and a shrunk or factor covariance.
```

## References

Read the one that matches the task; each has working code.

| File | Covers |
|---|---|
| `references/backtesting.md` | weight-based backtest with delay and costs, walk-forward splits, performance metrics, Sharpe haircut for multiple trials |
| `references/statistics.md` | stationarity, cointegration and pairs, half-life, GARCH volatility, factor regressions with robust errors |
| `references/portfolio-and-risk.md` | covariance shrinkage, mean-variance with constraints, risk parity, Black-Litterman, VaR and expected shortfall, Kelly sizing |
| `references/execution.md` | implementation shortfall, impact model, TWAP and VWAP schedules, order book measures, transaction cost analysis |

## Related skills

- `hedge-fund-blueprint`: the whole platform in build order, with a gate per build.
- `senior-quantitative-researcher`, `senior-quantitative-developer`,
  `senior-systematic-trader`, `senior-quantitative-trader`: role playbooks.
- `machine-learning`: model training and evaluation; the leakage rules there apply
  twice over to financial data.

Nothing here is investment advice. These are methods for testing ideas honestly.

