backtesting-frameworks
What it does
This tool helps build testing systems for investment strategies. It ensures tests are fair by avoiding common mistakes that can make a strategy seem better than it is.
When to use it
- βWhen creating tests for your investment ideas.
- βWhen building the infrastructure to test strategies.
- βWhen verifying if an investment strategy performs well.
Skill link
https://github.com/wshobson/agents/blob/main/plugins/quantitative-trading/skills/backtesting-frameworks/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI want to test my stock trading strategy, ensuring the tests are reliable.β
5 new skills a week. 1 minute to read.
How it works
It uses historical data intelligently, splitting it into parts for training and testing. This prevents the strategy from 'seeing the future' or the tests from being misleading due to incomplete data.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Backtesting Frameworks
Build robust, production-grade backtesting systems that avoid common pitfalls and produce reliable strategy performance estimates.
When to Use This Skill
- Developing trading strategy backtests
- Building backtesting infrastructure
- Validating strategy performance
- Avoiding common backtesting biases
- Implementing walk-forward analysis
- Comparing strategy alternatives
Core Concepts
1. Backtesting Biases
| Bias | Description | Mitigation |
|---|---|---|
| Look-ahead | Using future information | Point-in-time data |
| Survivorship | Only testing on survivors | Use delisted securities |
| Overfitting | Curve-fitting to history | Out-of-sample testing |
| Selection | Cherry-picking strategies | Pre-registration |
| Transaction | Ignoring trading costs | Realistic cost models |
2. Proper Backtest Structure
Historical Data
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Training Set β
β (Strategy Development & Optimization) β
βββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Validation Set β
β (Parameter Selection, No Peeking) β
βββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Test Set β
β (Final Performance Evaluation) β
βββββββββββββββββββββββββββββββββββββββββββ
3. Walk-Forward Analysis
Window 1: [Trainββββββ][Test]
Window 2: [Trainββββββ][Test]
Window 3: [Trainββββββ][Test]
Window 4: [Trainββββββ][Test]
ββββββΆ Time
Detailed worked examples and patterns
Detailed sections (starting with ## Implementation Patterns) live in references/details.md. Read that file when the navigation summary above is insufficient.
Best Practices
Do's
- Use point-in-time data - Avoid look-ahead bias
- Include transaction costs - Realistic estimates
- Test out-of-sample - Always reserve data
- Use walk-forward - Not just train/test
- Monte Carlo analysis - Understand uncertainty
Don'ts
- Don't overfit - Limit parameters
- Don't ignore survivorship - Include delisted
- Don't use adjusted data carelessly - Understand adjustments
- Don't optimize on full history - Reserve test set
- Don't ignore capacity - Market impact matters
FAQ
What is 'look-ahead bias'?
It's when a test uses information that would only be available after the fact, making the strategy seem more profitable than it would be in real life.
What is 'survivorship bias'?
It's when tests only consider investments that 'survived' (didn't fail or get delisted), ignoring those that failed and skewing the results.
What are 'transaction costs'?
These are the real costs of buying and selling assets, like fees and taxes, which need to be included in tests for a realistic outcome.
Details
Original description by the author
Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strategies, or building backtesting infrastructure.
repo: wshobson/agents
Popularity
- GitHub stars
- 41k
- Ranking position
- #6771
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
screen-reader-testing
41kHas your agent test websites using screen readers to ensure they are accessible.
wcag-audit-patterns
41kHelps your agent audit websites for accessibility and fix issues according to WCAG guidelines.
multi-reviewer-patterns
41kEnables your agent to coordinate parallel code reviews, deduplicating findings and consolidating reports.
parallel-debugging
41kAllows the agent to debug complex issues with parallel investigations and root cause analysis.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.