回测框架
- 作者仓库星标 36,312
- 作者仓库 agents
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @wshobson · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# 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
章节与文件索引
按说明文件中的顺序排列。
何时使用此技能
1. 回测偏差
详细的工作示例和模式
要做的事
不该做的事
文件/命令 -> ## Implementation Patterns · references/details.md · train/test
内容校验值 -> 6a5adff9e3a1
当前原文的自动摘译,尚未人工审校。
何时使用此技能
开发交易策略回测 构建回测基础设施 验证策略绩效 避免常见的回测偏差 实施前瞻分析
1. 回测偏差
偏差 · 描述 · 缓解措施 前瞻 · 使用未来信息 · 时间点数据 生存 · 仅对幸存者进行测试 · 使用退市证券 过度拟合 · 曲线拟合历史记录 · 样本外测试 选择 · 择优策略 · 预注册
详细的工作示例和模式
详细部分(从
## Implementation Patterns开始)位于references/details.md。当上面的导航摘要不够时,请阅读该文件。要做的事
使用时间点数据 - 避免前瞻偏差 包括交易成本 - 现实的估计 测试样本外 - 始终保留数据 使用前瞻 - 不仅仅是训练/测试蒙特卡洛分析 - 理解不确定性
不该做的事
不要过度拟合 - 限制参数 不要忽略生存 - 包括退市 不要粗心地使用调整后的数据 - 了解调整 不要在完整历史上优化 - 保留测试集 不要忽略容量 - 市场影响很重要