波动率 AI 强制持有逻辑准确判断(尤其是亏损时的判断)

This commit is contained in:
zhangkun9038@dingtalk.com 2025-12-27 02:03:42 +08:00
parent d812319450
commit 418559b51d

View File

@ -882,8 +882,11 @@ class FreqaiPrimer(IStrategy):
# 确保概率在 [0, 1] 范围内(分类器输出可能有浮点误差)
exit_prob = max(0.0, min(1.0, exit_prob))
# 从 kwargs 获取当前利润freqtrade 会传入 current_profit
current_profit = float(kwargs.get('current_profit', 0.0))
# 获取当前利润:优先从 trade 对象获取,其次从 kwargs 获取
if hasattr(trade, 'calc_profit_ratio'):
current_profit = trade.calc_profit_ratio(rate)
else:
current_profit = float(kwargs.get('current_profit', 0.0))
# 获取出场一字基础阈值
base_threshold = self.ml_exit_signal_threshold.value