log里加入时间

This commit is contained in:
zhangkun9038@dingtalk.com 2026-01-08 15:42:23 +08:00
parent 780678eaaa
commit ec32472f19

View File

@ -87,6 +87,10 @@ class FreqaiPrimer(IStrategy):
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
current_candle = dataframe.iloc[-1] # 获取最新K线
# 使用K线的时间戳而不是current_time确保回测时显示正确的时间
candle_time = pd.to_datetime(current_candle.name)
timestamp = candle_time.strftime('%Y-%m-%d %H:%M:%S')
# 1. 价格与短期高点的关系
lookback_period = 5
if len(dataframe) >= lookback_period:
@ -141,8 +145,7 @@ class FreqaiPrimer(IStrategy):
ml_prob_str = f"{entry_prob:.2f}"
else:
ml_prob_str = "N/A"
# 添加时间戳信息到日志
timestamp = current_time.strftime('%Y-%m-%d %H:%M:%S')
# 使用K线时间戳而不是current_time参数
self.strategy_log(
f"[入场诊断] {timestamp} | {pair} | "
f"价格: {current_close:.6f} | "