VectorBT 向量回测
VectorBT 向量回测:基于 VectorBT 框架的向量化回测与因子研究工具,支持多市场数据批量回测、策略参数优化和统计套利分析。 含 25 条反模式约束。
晶体简介
Constraints
Evidence Quality
Medium confidence — review before critical use
70 条不可违反的约束
WHENWhen implementing Data.download_symbol or Data.update_symbol
ACTIONOverride the abstract method with source-specific implementation
CONSEQUENCEBase class raises NotImplementedError, preventing any data download operation. The plugin architecture requires subclass implementation for each data source (Yahoo Finance, Binance, CCXT, Alpaca, synthetic).
WHENWhen downloading multiple symbols into Data object
ACTIONVerify each symbols share the same temporal index after alignment
CONSEQUENCEVectorBT performs vectorized matrix operations across symbols. Misaligned indexes cause incorrect broadcast calculations, producing wrong trading signals and invalid backtest results. Matrix operations require uniform index across all symbols.
WHENWhen downloading price data for indicator computation
ACTIONInclude OHLCV columns (Open, High, Low, Close, Volume) in the downloaded data
CONSEQUENCEOHLCV accessors (pd.DataFrame.vbt.ohlcv.*) return None for missing columns, causing indicators like SMA, EMA, MACD to receive empty data and produce NaN results. Downstream portfolio simulation fails with no signals generated.
常见问题
讨论 (0)
暂无讨论,成为第一个发言的人吧!
更新历史
v0.1.0: 首次发布到 Doramagic.ai。基于 zvtvz/zvt 的自动化 batch-v1 元数据 + 自动生成 FAQ。