/backtesting
Academic backtesting framework for quantitative research. ~30 risk and performance ratios, 10 classes of indicators, event-driven engine with 6+ strategies, MPT optimizer, forward-looking simulation with Johnson SU + t-Copula, walk-forward CV, stress testing, fundamental
Claude Code
$ npx -y skills add gauss314/skills --skill backtesting --agent claude-code
Codex
$ npx skills add gauss314/skills --skill backtesting -a codex -y
Cursor
$ npx skills add gauss314/skills --skill backtesting -a cursor -y
Gemini CLI
$ npx skills add gauss314/skills --skill backtesting -a gemini-cli -y
GitHub Copilot
$ npx skills add gauss314/skills --skill backtesting -a github-copilot -y
OpenCode
$ npx skills add gauss314/skills --skill backtesting -a opencode -y
Windsurf
$ npx skills add gauss314/skills --skill backtesting -a windsurf -y
SKILL.md
backtesting.SKILL.mdname: backtesting
description: "Academic backtesting framework for quantitative research. ~30 risk and performance ratios, 10 classes of indicators, event-driven engine with 6+ strategies, MPT optimizer, forward-looking simulation with Johnson SU + t-Copula, walk-forward CV, stress testing, fundamental analysis (Altman Z, Piotroski, DuPont). All flat Python + numpy."
license: MIT
Backtesting — Full Backtesting Skill
This skill implements the **full 5-stage backtesting methodology** from the course material: Data → Research → Metrics → Parameterisation → Validation. It provides:
- **30+ risk/performance ratios** (flat, numpy-vectorized, no classes)
- **10 classes of indicators** following the course taxonomy (trend-following, oscillators, contrarians, flow, combined, discrete counts, seasonality, statistical, referential, fundamental)
- **Event-driven backtesting engine** with 8 built-in strategies
- **Forward-looking simulation** (Johnson SU marginals + t/Gaussian copula)
- **Portfolio theory** (Markowitz efficient frontier, portfolio-of-portfolios)
- **Walk-forward cross-validation** with IS/OOS split + gap
- **Stress testing** with parametric scenario shocks
- **Fundamental analysis** (Altman Z, Piotroski F, DuPont)
All scripts use only `numpy`, `pandas`, and `scipy`. No heavy dependencies.
Part of the [Gauss314 Skills Repository](https://github.com/gauss314/skills).
---
File Map
skills/backtesting/
├── SKILL.md ← This file
├── references/
│ ├── BACKTESTING_THEORY.md ← Marco conceptual: GIGO, trilema, 5 etapas (ES)
│ ├── RATIOS.md ← Fórmulas, convención de retornos, advertencias (ES)
│ ├── FEATURES.md ← Taxonomía de 10 clases de indicadores con edges (ES)
│ ├── SIMULATIONS.md ← Pipeline Johnson SU + cópula (ES)
│ ├── VALIDATION.md ← Suite de validación de 4 niveles (ES)
│ └── OTHER_FEATURES.md ← Fundamental, Sentimiento, Exógenos (ES)
├── assets/
│ ├── sp500_returns.csv ← SPY benchmark daily returns (lin + log), 1980-today
│ ├── momentum_sma50_200_returns.csv ← SMA(50)/SMA(200) crossover strategy returns
│ ├── contrarian_bbands_returns.csv ← Bollinger Band contrarian strategy returns
│ ├── sample_portfolios.json ← Real investor portfolios (Buffett, Dalio, Ackman, 60/40)
│ ├── defaults.json ← Default parameters (VaR alpha, windows, etc.)
│ └── validation_cases.json ← 6 known cases for ratio validation
├── scripts/
│ ├── __init__.py
│ ├── ratios.py ← 30+ flat numpy functions for all risk/performance ratios
│ ├── indicators.py ← 10 classes of technical/statistical/fundamental indicators
│ ├── engine.py ← Event-driven BacktestEngine with 8 built-in strategies
│ ├── backtesting.py ← CLI: run, sweep, walkforward, montecarlo, optmpt, event, validate
│ ├── simulations.py ← CLI: marginal, copula, run, portfolio, scenarios
│ ├── forward.py ← CLI: project, risk, stress, summary
│ ├── distributions.py ← Fit + KS test for Normal/t/NCt/Laplace/JohnsonSU
│ ├── copulas.py ← t/Gaussian/Clayton/Gumbel/Frank copulas + sampling
│ ├── fundamental_ratios.py ← Income/balance/cashflow metrics, DuPont, Altman Z, Piotroski
│ └── validate.py ← 4-level validation: CLI modes, math consistency, edge cases, regression
└── tests/
└── test_ratios.py ← 18 pytest tests for core ratiosWhat each file does
| File | Role | Key Functions / Modes | |------|------|-----------------------| | `ratios.py` | The core library. Every ratio is a flat function accepting 1-D arrays. | `sharpe_ratio`, `max_drawdown`, `var_all`, `cvar_all`, `kelly_fraction`, `payoff_ratio`, `profit_factor`, `rachev_a/b/c`, `common_sense_ratio`, `ruin_curve`, `compute_all` | | `indicators.py` | 10 classes of indicators, covering all types from the course taxonomy. | `rsi`, `adx`, `bbands`, `macd`, `atr`, `cross_indicator`, `range_bound`, `zscore_norm`, `poisson_rate`, `binomial_ratio`, `fourier_terms`, `best_fit_dist` | | `engine.py` | BacktestEngine class and 8 strategy functions. | `BacktestEngine`, `strategy_sma_crossover`, `strategy_rsi_cross`, `strategy_bbands_contrarian`, `strategy_growth_momentum_combo` | | `backtesting.py` | Main CLI. Run full backtests, walks, sweeps, optimization. | `run`, `sweep`, `walkforward`, `montecarlo`, `optmpt`, `event`, `validate`, `bench` | | `simulations.py` | Forward-looking simulation with Johnson SU + copula. | `marginal`, `copula`, `run`, `portfolio`, `scenarios` | | `forward.py` | Risk projection and stress testing. | `project`, `risk`, `stress`, `summary` | | `distributions.py` | Distribution fitting and comparison. | `fit`, `best_fit`, `compare_distributions`, `sample` | | `copulas.py` | Copula fitting and sampling. | `fit_t`, `fit_gaussian`, `sample_t`, `sample_gaussian`, `validate_copula` | | `fundamental_ratios.py` | Fundamental analysis ratios. | `income_metrics`, `valuation_metrics`, `dupont`, `altman_z`, `piotroski` | | `validate.py` | 4-level integration testing suite. | 33 checks across CLI, math, edge cases, regression |
---
Quick Start
Basic Ratios
# Compute all 30+ ratios on a CSV of prices
py scripts/backtesting.py run --prices assets/sp500_returns.csv
# Compute with benchmark comparison
py scripts/backtesting.py run --prices assets/momentum_sma50_200_returns.csv --benchmark assets/sp500_returns.csv
Validate (4-level suite)
# Full validation (33 checks across 4 levels)
py scripts/validate.py
# Single level
py scripts/validate.py --nivel 1
Validates CLI modes, mathematical consistency of all ratios, edge case resilience, and post-fix regression. See [`references/VALIDATION.md`](./references/VALIDATION.md) for the detailed breakdown of all 33 checks.
Event-Driv
Read more
name: backtesting description: "Academic backtesting framework for quantitative research. ~30 risk and performance ratios, 10 classes of indicators, event-driven engine with 6+ strategies, MPT optimizer, forward-looking simulation with Johnson SU + t-Copula, walk-forward CV, stress testing, fundamental analysis (Altman Z, Piotroski, DuPont). All flat Python + numpy." license: MIT
Backtesting — Full Backtesting Skill
This skill implements the **full 5-stage backtesting methodology** from the course material: Data → Research → Metrics → Parameterisation → Validation. It provides:
- **30+ risk/performance ratios** (flat, numpy-vectorized, no classes)
- **10 classes of indicators** following the course taxonomy (trend-following, oscillators, contrarians, flow, combined, discrete counts, seasonality, statistical, referential, fundamental)
- **Event-driven backtesting engine** with 8 built-in strategies
- **Forward-looking simulation** (Johnson SU marginals + t/Gaussian copula)
- **Portfolio theory** (Markowitz efficient frontier, portfolio-of-portfolios)
- **Walk-forward cross-validation** with IS/OOS split + gap
- **Stress testing** with parametric scenario shocks
- **Fundamental analysis** (Altman Z, Piotroski F, DuPont)
All scripts use only `numpy`, `pandas`, and `scipy`. No heavy dependencies.
Part of the [Gauss314 Skills Repository](https://github.com/gauss314/skills).
---
File Map
skills/backtesting/
├── SKILL.md ← This file
├── references/
│ ├── BACKTESTING_THEORY.md ← Marco conceptual: GIGO, trilema, 5 etapas (ES)
│ ├── RATIOS.md ← Fórmulas, convención de retornos, advertencias (ES)
│ ├── FEATURES.md ← Taxonomía de 10 clases de indicadores con edges (ES)
│ ├── SIMULATIONS.md ← Pipeline Johnson SU + cópula (ES)
│ ├── VALIDATION.md ← Suite de validación de 4 niveles (ES)
│ └── OTHER_FEATURES.md ← Fundamental, Sentimiento, Exógenos (ES)
├── assets/
│ ├── sp500_returns.csv ← SPY benchmark daily returns (lin + log), 1980-today
│ ├── momentum_sma50_200_returns.csv ← SMA(50)/SMA(200) crossover strategy returns
│ ├── contrarian_bbands_returns.csv ← Bollinger Band contrarian strategy returns
│ ├── sample_portfolios.json ← Real investor portfolios (Buffett, Dalio, Ackman, 60/40)
│ ├── defaults.json ← Default parameters (VaR alpha, windows, etc.)
│ └── validation_cases.json ← 6 known cases for ratio validation
├── scripts/
│ ├── __init__.py
│ ├── ratios.py ← 30+ flat numpy functions for all risk/performance ratios
│ ├── indicators.py ← 10 classes of technical/statistical/fundamental indicators
│ ├── engine.py ← Event-driven BacktestEngine with 8 built-in strategies
│ ├── backtesting.py ← CLI: run, sweep, walkforward, montecarlo, optmpt, event, validate
│ ├── simulations.py ← CLI: marginal, copula, run, portfolio, scenarios
│ ├── forward.py ← CLI: project, risk, stress, summary
│ ├── distributions.py ← Fit + KS test for Normal/t/NCt/Laplace/JohnsonSU
│ ├── copulas.py ← t/Gaussian/Clayton/Gumbel/Frank copulas + sampling
│ ├── fundamental_ratios.py ← Income/balance/cashflow metrics, DuPont, Altman Z, Piotroski
│ └── validate.py ← 4-level validation: CLI modes, math consistency, edge cases, regression
└── tests/
└── test_ratios.py ← 18 pytest tests for core ratiosWhat each file does
| File | Role | Key Functions / Modes | |------|------|-----------------------| | `ratios.py` | The core library. Every ratio is a flat function accepting 1-D arrays. | `sharpe_ratio`, `max_drawdown`, `var_all`, `cvar_all`, `kelly_fraction`, `payoff_ratio`, `profit_factor`, `rachev_a/b/c`, `common_sense_ratio`, `ruin_curve`, `compute_all` | | `indicators.py` | 10 classes of indicators, covering all types from the course taxonomy. | `rsi`, `adx`, `bbands`, `macd`, `atr`, `cross_indicator`, `range_bound`, `zscore_norm`, `poisson_rate`, `binomial_ratio`, `fourier_terms`, `best_fit_dist` | | `engine.py` | BacktestEngine class and 8 strategy functions. | `BacktestEngine`, `strategy_sma_crossover`, `strategy_rsi_cross`, `strategy_bbands_contrarian`, `strategy_growth_momentum_combo` | | `backtesting.py` | Main CLI. Run full backtests, walks, sweeps, optimization. | `run`, `sweep`, `walkforward`, `montecarlo`, `optmpt`, `event`, `validate`, `bench` | | `simulations.py` | Forward-looking simulation with Johnson SU + copula. | `marginal`, `copula`, `run`, `portfolio`, `scenarios` | | `forward.py` | Risk projection and stress testing. | `project`, `risk`, `stress`, `summary` | | `distributions.py` | Distribution fitting and comparison. | `fit`, `best_fit`, `compare_distributions`, `sample` | | `copulas.py` | Copula fitting and sampling. | `fit_t`, `fit_gaussian`, `sample_t`, `sample_gaussian`, `validate_copula` | | `fundamental_ratios.py` | Fundamental analysis ratios. | `income_metrics`, `valuation_metrics`, `dupont`, `altman_z`, `piotroski` | | `validate.py` | 4-level integration testing suite. | 33 checks across CLI, math, edge cases, regression |
---
Quick Start
Basic Ratios
# Compute all 30+ ratios on a CSV of prices py scripts/backtesting.py run --prices assets/sp500_returns.csv # Compute with benchmark comparison py scripts/backtesting.py run --prices assets/momentum_sma50_200_returns.csv --benchmark assets/sp500_returns.csv
Validate (4-level suite)
# Full validation (33 checks across 4 levels) py scripts/validate.py # Single level py scripts/validate.py --nivel 1
Validates CLI modes, mathematical consistency of all ratios, edge case resilience, and post-fix regression. See [`references/VALIDATION.md`](./references/VALIDATION.md) for the detailed breakdown of all 33 checks.
Event-Driv
Open-source collection of skills compatible with the SKILL.md standard. Developed for the AI courses at UCEMA.
Other skills on skills.
More skills from other plugins.
3-statement-model
Complete, populate and fill out 3-statement financial model templates (Income Statement, Balance Sheet, Cash Flow Statement) .…
3-statement-model
Complete, populate and fill out 3-statement financial model templates (Income Statement, Balance Sheet, Cash Flow Statement) .…
Questions about backtesting.
- Which coding agents can use backtesting?
- backtesting installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.

