From 8c0b6669d89a28a0058f36742e33c96285636d96 Mon Sep 17 00:00:00 2001 From: "zhangkun9038@dingtalk.com" Date: Fri, 4 Jul 2025 15:42:51 +0000 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AF=B9populate=5Findicate=E7=9A=84=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- freqtrade/templates/freqaiprimer.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/freqtrade/templates/freqaiprimer.py b/freqtrade/templates/freqaiprimer.py index 4980cc0f..c5bc98b3 100644 --- a/freqtrade/templates/freqaiprimer.py +++ b/freqtrade/templates/freqaiprimer.py @@ -567,20 +567,10 @@ class FreqaiPrimer(IStrategy): return True def confirm_trade_exit(self, pair: str, trade: Trade, order_type: str, amount: float, - rate: float, time_in_force: str, exit_reason: str, - current_time: datetime, **kwargs) -> bool: - adjusted_rate = rate * (1 + 0.005) - - # 获取最新的 dataframe 以提取触发条件 - dataframe = self.dp.get_pair_dataframe(pair=pair, timeframe=self.timeframe) - dataframe = self.populate_indicators(dataframe, {'pair': pair}) - dataframe = self.populate_exit_trend(dataframe, {'pair': pair}) - - # 获取退出条件信息 - exit_conditions = dataframe['exit_conditions'].iloc[-1] if 'exit_conditions' in dataframe.columns and not dataframe['exit_conditions'].isna().iloc[-1] else "Unknown" - - logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 原始利润:{trade.calc_profit_ratio(rate):.2%}, " - f"调整后卖出价:{adjusted_rate:.6f}, 触发条件:{exit_conditions}") + rate: float, time_in_force: str, exit_reason: str, + current_time: datetime, **kwargs) -> bool: + adjusted_rate = rate * (1 + 0.0025) + logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 原始利润:{trade.calc_profit_ratio(rate):.2%},"f"调整后卖出价:{adjusted_rate:.6f}") return True def custom_roi(self, trade: Trade, current_profit: float, current_time: datetime, trade_dur: int,