log增强

This commit is contained in:
Ubuntu 2025-07-30 21:41:09 +08:00
parent a8d189a76e
commit 6a2e1c612b

View File

@ -460,34 +460,34 @@ class FreqaiPrimer(IStrategy):
stochrsi_value = dataframe["stochrsi_k"].iloc[-1]
bb_close_value = dataframe["close"].iloc[-1]
bb_lower_value = dataframe["bb_lowerband"].iloc[-1]
# 定义条件名称和状态
conditions_summary = [
("&-price_value_divergence", divergence_value, "<", self.buy_threshold, cond1.iloc[-1]),
("volume_z_score", volume_z_score_value, ">", volume_z_score_threshold, cond2.iloc[-1]),
("rsi", rsi_value, "<", rsi_threshold, cond3.iloc[-1]),
("close <= bb_lowerband", bb_close_value, "<=", bb_lower_value, cond4.iloc[-1]),
("stochrsi_k", stochrsi_value, "<", stochrsi_threshold, cond5.iloc[-1]),
("非熊市", None, None, None, cond6.iloc[-1]),
("STOCHRSI未持续超买", None, None, None, cond7.iloc[-1]),
]
# 定义条件名称和状态
conditions_summary = [
("&-price_value_divergence", divergence_value, "<", self.buy_threshold, cond1.iloc[-1]),
("volume_z_score", volume_z_score_value, ">", volume_z_score_threshold, cond2.iloc[-1]),
("rsi", rsi_value, "<", rsi_threshold, cond3.iloc[-1]),
("close <= bb_lowerband", bb_close_value, "<=", bb_lower_value, cond4.iloc[-1]),
("stochrsi_k", stochrsi_value, "<", stochrsi_threshold, cond5.iloc[-1]),
("非熊市", None, None, None, cond6.iloc[-1]),
("STOCHRSI未持续超买", None, None, None, cond7.iloc[-1]),
]
# 输出每个条件的状态
logger.info(f"[{pair}] === 买入条件检查 ===")
failed_conditions = []
for name, value, operator, threshold, result in conditions_summary:
status = "" if result else ""
if value is not None and threshold is not None:
logger.info(f"[{pair}] {status} {name}: {value:.6f} {operator} {threshold:.6f}")
# 输出每个条件的状态
logger.info(f"[{pair}] === 买入条件检查 ===")
failed_conditions = []
for name, value, operator, threshold, result in conditions_summary:
status = "" if result else ""
if value is not None and threshold is not None:
logger.info(f"[{pair}] {status} {name}: {value:.6f} {operator} {threshold:.6f}")
else:
logger.info(f"[{pair}] {status} {name}")
if not result:
failed_conditions.append(name)
# 总结未通过的条件
if failed_conditions:
logger.info(f"[{pair}] ❌ 买入条件未满足,原因:以下条件未通过: {', '.join(failed_conditions)}")
else:
logger.info(f"[{pair}] {status} {name}")
if not result:
failed_conditions.append(name)
# 总结未通过的条件
if failed_conditions:
logger.info(f"[{pair}] ❌ 买入条件未满足,原因:以下条件未通过: {', '.join(failed_conditions)}")
else:
logger.info(f"[{pair}] ✅ 所有买入条件均已满足")
logger.info(f"[{pair}] ✅ 所有买入条件均已满足")
else:
logger.warning(f"[{pair}] &-price_value_divergence 列缺失,跳过买入信号生成")