修复未来函数bug
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user