mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 15:44:15 +08:00
release: v1.14.1 — 高级回测 ExecutionModel 路径 3 个真实数据兼容 Bug 修复
- datetime 类型分歧(致命):Trade.datetime 转 int 与 PortfolioTracker 的 Timestamp key 失配,TWAP/VWAP/Limit 路径交易全部静默丢失、权益曲线恒定、收益归零 - volume 列名分歧:回测认 volume 而真实行情为 vol,滑点 volume 恒 0 退化百分比模式,VWAP 退化为等权 - date/datetime 列名分歧:日线返回 date 列引擎要 datetime,run() 入口由 date 派生下游无感兼容 新增 3 个回归测试(均红灯验证)。650 单测通过,backtest 模块 ruff + mypy strict 清洁。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -312,9 +312,12 @@ class OrderSimulator:
|
||||
return size * self.slippage
|
||||
|
||||
def _get_current_volume(self) -> float:
|
||||
"""获取最后一根K线的成交量。"""
|
||||
if "volume" in self.df.columns and len(self.df) > 0:
|
||||
return float(self.df["volume"].iloc[-1])
|
||||
"""获取最后一根K线的成交量,兼容 vol/volume 列名。"""
|
||||
if len(self.df) == 0:
|
||||
return 0.0
|
||||
for col in ("vol", "volume"):
|
||||
if col in self.df.columns:
|
||||
return float(self.df[col].iloc[-1])
|
||||
return 0.0
|
||||
|
||||
def _estimate_volatility(self) -> float:
|
||||
|
||||
Reference in New Issue
Block a user