custom_exit_price
This commit is contained in:
parent
e1459c2deb
commit
3c42298f5c
@ -372,15 +372,18 @@ class FreqaiPrimer(IStrategy):
|
||||
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:
|
||||
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.5% 下单
|
||||
adjusted_rate = proposed_rate * (1 - 0.0025)
|
||||
adjusted_rate = proposed_rate * (1 - 0.005)
|
||||
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:
|
||||
def custom_exit_price(self, pair: str, trade: Trade,
|
||||
current_time: datetime, proposed_rate: float,
|
||||
current_profit: float, exit_tag: str | None, **kwargs) -> float:
|
||||
# 比当前市场价高 0.25% 下单
|
||||
adjusted_rate = proposed_rate * (1 + 0.0025)
|
||||
logger.debug(f"[{pair}] 自定义卖出价:{adjusted_rate:.6f}(原价:{proposed_rate:.6f})")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user