safe_wrapper should use kwargs to call methods

This commit is contained in:
Matthias 2021-04-26 20:18:03 +02:00
parent 2061162d79
commit 55faa6a84a

View File

@ -579,7 +579,8 @@ class IStrategy(ABC, HyperStrategyMixin):
sell_signal = SellType.SELL_SIGNAL sell_signal = SellType.SELL_SIGNAL
else: else:
custom_reason = strategy_safe_wrapper(self.custom_sell, default_retval=False)( custom_reason = strategy_safe_wrapper(self.custom_sell, default_retval=False)(
trade.pair, trade, date, current_rate, current_profit, dataframe) pair=trade.pair, trade=trade, current_time=date, current_rate=current_rate,
current_profit=current_profit, dataframe=dataframe)
if custom_reason: if custom_reason:
sell_signal = SellType.CUSTOM_SELL sell_signal = SellType.CUSTOM_SELL
if isinstance(custom_reason, str): if isinstance(custom_reason, str):
@ -598,8 +599,7 @@ class IStrategy(ABC, HyperStrategyMixin):
# Sell-signal # Sell-signal
# Stoploss # Stoploss
if roi_reached and stoplossflag.sell_type != SellType.STOP_LOSS: if roi_reached and stoplossflag.sell_type != SellType.STOP_LOSS:
logger.debug(f"{trade.pair} - Required profit reached. " logger.debug(f"{trade.pair} - Required profit reached. sell_type=SellType.ROI")
f"sell_type=SellType.ROI")
return SellCheckTuple(sell_type=SellType.ROI) return SellCheckTuple(sell_type=SellType.ROI)
if sell_signal != SellType.NONE: if sell_signal != SellType.NONE:
@ -610,8 +610,7 @@ class IStrategy(ABC, HyperStrategyMixin):
if stoplossflag.sell_flag: if stoplossflag.sell_flag:
logger.debug(f"{trade.pair} - Stoploss hit. " logger.debug(f"{trade.pair} - Stoploss hit. sell_type={stoplossflag.sell_type}")
f"sell_type={stoplossflag.sell_type}")
return stoplossflag return stoplossflag
# This one is noisy, commented out... # This one is noisy, commented out...