既然trade.current_profit()总是返回0,那么依赖它的所有逻辑都是不可信的。让我将这些逻辑全部移除,不再依赖这个值

This commit is contained in:
zhangkun9038@dingtalk.com 2026-02-10 13:34:07 +08:00
parent cf436211ea
commit 0cf303e65b

View File

@ -1553,7 +1553,7 @@ class FreqaiPrimer(IStrategy):
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, current_profit: float, **kwargs) -> bool:
current_time: datetime, **kwargs) -> bool:
"""
智能出场确认结合ML预测信号来决定是否出场
"""
@ -1591,11 +1591,11 @@ class FreqaiPrimer(IStrategy):
if '&-target_trend' in df.columns:
trend_prediction = float(last_row['&-target_trend'])
# 基于ML预测的智能决策
# 基于ML预测的智能决策移除了对不可靠的current_profit的依赖
if current_entry_prob is not None and predicted_volatility is not None:
# 如果当前入场信号概率很高,说明市场条件仍然良好,可以继续持有
if current_entry_prob > 0.6 and current_profit < 0.05:
# 高入场概率 + 低利润,建议继续持有(除非已有相当利润)
if current_entry_prob > 0.6:
# 高入场概率,建议继续持有
self.strategy_log(f"[{pair}] 当前入场信号概率高({current_entry_prob:.2f}),建议继续持有")
return False # 阻止出场