From 1e31f22ee864352faf2b3433582d84eb40023771 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 30 Jul 2025 21:35:48 +0800 Subject: [PATCH] =?UTF-8?q?log=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- freqtrade/templates/freqaiprimer.py | 36 ++++++++++++++----- ...和 `volume_z_score` 未通过,改进后的日志输出如下: | 13 +++++++ 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 tools/假设某次运行中,`&-price_value_divergence` 和 `volume_z_score` 未通过,改进后的日志输出如下: diff --git a/freqtrade/templates/freqaiprimer.py b/freqtrade/templates/freqaiprimer.py index 98622e30..e5f5817c 100644 --- a/freqtrade/templates/freqaiprimer.py +++ b/freqtrade/templates/freqaiprimer.py @@ -460,14 +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] - logger.info(f"[{pair}] 买入条件检查 - " - f"&-price_value_divergence={divergence_value:.6f} < {self.buy_threshold:.6f}: {cond1.iloc[-1]}, " - f"volume_z_score={volume_z_score_value:.2f} > {volume_z_score_threshold:.2f}: {cond2.iloc[-1]}, " - f"rsi={rsi_value:.2f} < {rsi_threshold:.2f}: {cond3.iloc[-1]}, " - f"close={bb_close_value:.6f} <= bb_lowerband={bb_lower_value:.6f}: {cond4.iloc[-1]}, " - f"stochrsi_k={stochrsi_value:.2f} < {stochrsi_threshold:.2f}: {cond5.iloc[-1]}, " - f"非熊市={cond6.iloc[-1]}, " - f"STOCHRSI未持续超买={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}") + 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}] ✅ 所有买入条件均已满足") else: logger.warning(f"[{pair}] &-price_value_divergence 列缺失,跳过买入信号生成") diff --git a/tools/假设某次运行中,`&-price_value_divergence` 和 `volume_z_score` 未通过,改进后的日志输出如下: b/tools/假设某次运行中,`&-price_value_divergence` 和 `volume_z_score` 未通过,改进后的日志输出如下: new file mode 100644 index 00000000..18bfeacc --- /dev/null +++ b/tools/假设某次运行中,`&-price_value_divergence` 和 `volume_z_score` 未通过,改进后的日志输出如下: @@ -0,0 +1,13 @@ + +<<<<<<< HEAD +======= +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] === 买入条件检查 === +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ❌ &-price_value_divergence: -0.017264 < -0.018560 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ❌ volume_z_score: -0.39 > 1.21 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ✅ rsi: 46.80 < 49.20 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ❌ close <= bb_lowerband: 3.765000 <= 3.755910 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ❌ stochrsi_k: 93.36 < 39.20 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ✅ 非熊市 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ✅ STOCHRSI未持续超买 +2025-07-30 13:27:24 INFO freqaiprimer - [DOT/USDT] ❌ 买入条件未满足,原因:以下条件未通过: &-price_value_divergence, volume_z_score, close <= bb_lowerband, stochrsi_k +>>>>>>> Snippet