重新定价
This commit is contained in:
parent
4b57b8e281
commit
e1459c2deb
@ -359,10 +359,6 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f"[{pair}] 5分钟内有近期交易({len(recent_trades)} 笔),跳过本次入场")
|
||||
return False
|
||||
|
||||
# 调整买入价格:比当前报价低 0.5%
|
||||
adjusted_rate = rate * (1 - 0.0025)
|
||||
logger.debug(f"[{pair}] 原始买入价:{rate:.6f},调整后买入价:{adjusted_rate:.6f}")
|
||||
|
||||
self.trailing_stop_enabled = False
|
||||
return True
|
||||
|
||||
@ -374,3 +370,18 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f"[{pair}] 退出交易,原因:{exit_reason}, 原始利润:{trade.calc_profit_ratio(rate):.2%},"
|
||||
f"调整后卖出价:{adjusted_rate:.6f}")
|
||||
return True
|
||||
### 1️⃣ 自定义买入价格:`custom_entry_price()`
|
||||
|
||||
def custom_entry_price(self, pair: str, current_time: datetime, proposed_rate: float, entry_tag: str, side: str, **kwargs) -> float:
|
||||
# 比当前市场价低 0.5% 下单
|
||||
adjusted_rate = proposed_rate * (1 - 0.0025)
|
||||
logger.debug(f"[{pair}] 自定义买入价:{adjusted_rate:.6f}(原价:{proposed_rate:.6f})")
|
||||
return adjusted_rate
|
||||
|
||||
### 2️⃣ 自定义卖出价格:`custom_exit_price()`
|
||||
|
||||
def custom_exit_price(self, pair: str, current_time: datetime, proposed_rate: float, trade: Trade, side: str, **kwargs) -> float:
|
||||
# 比当前市场价高 0.25% 下单
|
||||
adjusted_rate = proposed_rate * (1 + 0.0025)
|
||||
logger.debug(f"[{pair}] 自定义卖出价:{adjusted_rate:.6f}(原价:{proposed_rate:.6f})")
|
||||
return adjusted_rate
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user