Backtesting Frameworks

作者 wshobson46891e7e60da無授權條款收錄於 2026年10月8日更新於 2026年10月8日

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.

僅含說明Business & Finance
AI 產生的概覽

指導建構穩健的交易策略回測系統,避免偏差並真實建模成本。

功能
此技能為建構生產級交易策略回測系統提供指引。它說明常見的回測偏差,例如未來函式、倖存者偏差、過度擬合、選擇偏差與交易成本偏差,並提出緩解方式。它概述正確的訓練/驗證/測試結構、前向滾動分析與最佳實務,詳細範例與模式則放在獨立的參考檔案中。
適用情境
適用於開發交易演算法、建置回測基礎設施、驗證策略績效或比較不同策略時。也適合用於實作前向滾動分析,或想避免常見回測偏差的情境。
執行需求
不含指令碼,僅為說明性內容。它依賴參考檔案(references/details.md)提供詳細範例與模式。

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

BiasDescriptionMitigation
Look-aheadUsing future informationPoint-in-time data
SurvivorshipOnly testing on survivorsUse delisted securities
OverfittingCurve-fitting to historyOut-of-sample testing
SelectionCherry-picking strategiesPre-registration
TransactionIgnoring trading costsRealistic 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

來源與署名

來源:wshobson/agents位於plugins/quantitative-trading/skills/backtesting-frameworks提交46891e7

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架