压低买价,太高卖价
This commit is contained in:
parent
ebcd85bc24
commit
4d6217997c
@ -359,13 +359,18 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f"[{pair}] 5分钟内有近期交易({len(recent_trades)} 笔),跳过本次入场")
|
||||
return False
|
||||
|
||||
# 检查其他限制(例如资金、仓位等)
|
||||
logger.debug(f"[{pair}] 允许买入 - 订单类型:{order_type}, 数量:{amount:.2f}, 价格:{rate:.6f}, 时间:{current_time}")
|
||||
# 调整买入价格:比当前报价低 0.5%
|
||||
adjusted_rate = rate * (1 - 0.005)
|
||||
logger.debug(f"[{pair}] 原始买入价:{rate:.6f},调整后买入价:{adjusted_rate:.6f}")
|
||||
|
||||
self.trailing_stop_enabled = False
|
||||
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:
|
||||
logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 利润:{trade.calc_profit_ratio(rate):.2%}")
|
||||
# 调整卖出价格:比当前报价高 0.25%
|
||||
adjusted_rate = rate * (1 + 0.0025)
|
||||
logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 原始利润:{trade.calc_profit_ratio(rate):.2%},"
|
||||
f"调整后卖出价:{adjusted_rate:.6f}")
|
||||
return True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user