抬高退出门槛
This commit is contained in:
parent
cd213ca366
commit
459c36ef8f
@ -567,11 +567,20 @@ 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.0025)
|
||||
logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 原始利润:{trade.calc_profit_ratio(rate):.2%},"
|
||||
f"调整后卖出价:{adjusted_rate:.6f}")
|
||||
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}")
|
||||
return True
|
||||
|
||||
def custom_roi(self, trade: Trade, current_profit: float, current_time: datetime, trade_dur: int,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user