修复未来函数bug

This commit is contained in:
2025-07-15 22:45:51 +08:00
parent 5de1a43b02
commit 5a2d0fb984
19 changed files with 15019 additions and 9388 deletions

View File

@@ -70,7 +70,7 @@ class ResultAnalyzer:
for trade in self.trade_history:
# 调整输出格式,显示实现盈亏
pnl_display = (
f" | Indicators:{trade.indicator_dict} | PnL: {trade.realized_pnl:.2f}"
f" | PnL: {trade.realized_pnl:.2f}"
if trade.is_close_trade
else ""
)
@@ -145,7 +145,8 @@ class ResultAnalyzer:
# 确保 trade.indicator_dict 中包含当前指标的值
# 并且这个值是可用的非None或NaN
if (
indicator_name in trade.indicator_dict
trade.indicator_dict is not None
and indicator_name in trade.indicator_dict
and trade.indicator_dict[indicator_name] is not None
):
# 检查是否为 NaN如果使用 np.nan则需要 isinstance(value, float) and np.isnan(value)