修复custom_entry_price和custom_exit_price的参数签名错误
This commit is contained in:
parent
0b9332e4db
commit
424069fc69
@ -1710,31 +1710,31 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
return adjusted_stake
|
||||
|
||||
def custom_exit_price(self, pair: str, trade: Trade, current_time: datetime, proposed_exit_price: float,
|
||||
current_profit: float, **kwargs) -> float:
|
||||
def custom_exit_price(self, pair: str, trade: Trade, current_time: datetime, proposed_rate: float,
|
||||
current_profit: float, exit_tag: str | None, **kwargs) -> float:
|
||||
"""
|
||||
自定义出场价格
|
||||
根据文档,价格调整逻辑应该放在这里,而不是在 custom_exit 中
|
||||
"""
|
||||
# 计算出场价格上浮比例(0.25%)
|
||||
price_markup_percent = 0.25
|
||||
adjusted_exit_price = proposed_exit_price * (1 + price_markup_percent / 100)
|
||||
adjusted_exit_price = proposed_rate * (1 + price_markup_percent / 100)
|
||||
|
||||
self.strategy_log(f"[{pair}] 自定义出场价格: 原价格 {proposed_exit_price:.8f} -> 调整后价格 {adjusted_exit_price:.8f}, 上浮: {price_markup_percent}%")
|
||||
self.strategy_log(f"[{pair}] 自定义出场价格: 原价格 {proposed_rate:.8f} -> 调整后价格 {adjusted_exit_price:.8f}, 上浮: {price_markup_percent}%")
|
||||
|
||||
return adjusted_exit_price
|
||||
|
||||
def custom_entry_price(self, pair: str, current_time: datetime, proposed_entry_price: float,
|
||||
entry_tag: str, side: str, **kwargs) -> float:
|
||||
def custom_entry_price(self, pair: str, trade: Trade | None, current_time: datetime,
|
||||
proposed_rate: float, entry_tag: str | None, side: str, **kwargs) -> float:
|
||||
"""
|
||||
自定义入场价格
|
||||
将入场价格调低0.25%,以提高成交概率
|
||||
"""
|
||||
# 计算入场价格下调比例(0.25%)
|
||||
price_discount_percent = 0.25
|
||||
adjusted_entry_price = proposed_entry_price * (1 - price_discount_percent / 100)
|
||||
adjusted_entry_price = proposed_rate * (1 - price_discount_percent / 100)
|
||||
|
||||
self.strategy_log(f"[{pair}] 自定义入场价格: 原价格 {proposed_entry_price:.8f} -> 调整后价格 {adjusted_entry_price:.8f}, 下调: {price_discount_percent}%")
|
||||
self.strategy_log(f"[{pair}] 自定义入场价格: 原价格 {proposed_rate:.8f} -> 调整后价格 {adjusted_entry_price:.8f}, 下调: {price_discount_percent}%")
|
||||
|
||||
return adjusted_entry_price
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user