|
|
|
|
@ -238,7 +238,8 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float,
|
|
|
|
|
time_in_force: str, current_time: datetime, **kwargs) -> bool:
|
|
|
|
|
time_in_force: str, current_time: datetime, entry_tag: Optional[str],
|
|
|
|
|
**kwargs) -> bool:
|
|
|
|
|
"""
|
|
|
|
|
Called right before placing a buy order.
|
|
|
|
|
Timing for this function is critical, so avoid doing heavy computations or
|
|
|
|
|
@ -254,6 +255,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
:param rate: Rate that's going to be used when using limit orders
|
|
|
|
|
:param time_in_force: Time in force. Defaults to GTC (Good-til-cancelled).
|
|
|
|
|
:param current_time: datetime object, containing the current datetime
|
|
|
|
|
:param entry_tag: Optional entry_tag (buy_tag) if provided with the buy signal.
|
|
|
|
|
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
|
|
|
|
|
:return bool: When True is returned, then the buy-order is placed on the exchange.
|
|
|
|
|
False aborts the process
|
|
|
|
|
@ -311,7 +313,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
return self.stoploss
|
|
|
|
|
|
|
|
|
|
def custom_entry_price(self, pair: str, current_time: datetime, proposed_rate: float,
|
|
|
|
|
**kwargs) -> float:
|
|
|
|
|
entry_tag: Optional[str], **kwargs) -> float:
|
|
|
|
|
"""
|
|
|
|
|
Custom entry price logic, returning the new entry price.
|
|
|
|
|
|
|
|
|
|
@ -322,6 +324,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
:param pair: Pair that's currently analyzed
|
|
|
|
|
:param current_time: datetime object, containing the current datetime
|
|
|
|
|
:param proposed_rate: Rate, calculated based on pricing settings in ask_strategy.
|
|
|
|
|
:param entry_tag: Optional entry_tag (buy_tag) if provided with the buy signal.
|
|
|
|
|
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
|
|
|
|
|
:return float: New entry price value if provided
|
|
|
|
|
"""
|
|
|
|
|
@ -373,7 +376,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
|
|
|
|
|
def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float,
|
|
|
|
|
proposed_stake: float, min_stake: float, max_stake: float,
|
|
|
|
|
**kwargs) -> float:
|
|
|
|
|
entry_tag: Optional[str], **kwargs) -> float:
|
|
|
|
|
"""
|
|
|
|
|
Customize stake size for each new trade. This method is not called when edge module is
|
|
|
|
|
enabled.
|
|
|
|
|
@ -384,6 +387,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|
|
|
|
:param proposed_stake: A stake amount proposed by the bot.
|
|
|
|
|
:param min_stake: Minimal stake size allowed by exchange.
|
|
|
|
|
:param max_stake: Balance available for trading.
|
|
|
|
|
:param entry_tag: Optional entry_tag (buy_tag) if provided with the buy signal.
|
|
|
|
|
:return: A stake size, which is between min_stake and max_stake.
|
|
|
|
|
"""
|
|
|
|
|
return proposed_stake
|
|
|
|
|
|