Merge branch 'develop' into feat/short

This commit is contained in:
Matthias
2022-02-23 06:27:56 +01:00
29 changed files with 252 additions and 202 deletions

View File

@@ -800,7 +800,7 @@ class IStrategy(ABC, HyperStrategyMixin):
else:
return False
def should_exit(self, trade: Trade, rate: float, date: datetime, *,
def should_exit(self, trade: Trade, rate: float, current_time: datetime, *,
enter: bool, exit_: bool,
low: float = None, high: float = None,
force_stoploss: float = 0) -> SellCheckTuple:
@@ -819,7 +819,8 @@ class IStrategy(ABC, HyperStrategyMixin):
trade.adjust_min_max_rates(high or current_rate, low or current_rate)
stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade,
current_time=date, current_profit=current_profit,
current_time=current_time,
current_profit=current_profit,
force_stoploss=force_stoploss, low=low, high=high)
# Set current rate to high for backtesting sell
@@ -829,7 +830,7 @@ class IStrategy(ABC, HyperStrategyMixin):
# if enter signal and ignore_roi is set, we don't need to evaluate min_roi.
roi_reached = (not (enter and self.ignore_roi_if_buy_signal)
and self.min_roi_reached(trade=trade, current_profit=current_profit,
current_time=date))
current_time=current_time))
sell_signal = SellType.NONE
custom_reason = ''
@@ -846,8 +847,8 @@ class IStrategy(ABC, HyperStrategyMixin):
else:
trade_type = "exit_short" if trade.is_short else "sell"
custom_reason = strategy_safe_wrapper(self.custom_sell, default_retval=False)(
pair=trade.pair, trade=trade, current_time=date, current_rate=current_rate,
current_profit=current_profit)
pair=trade.pair, trade=trade, current_time=current_time,
current_rate=current_rate, current_profit=current_profit)
if custom_reason:
sell_signal = SellType.CUSTOM_SELL
if isinstance(custom_reason, str):