diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index b47fbf028..1364898fc 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -797,7 +797,6 @@ class IStrategy(ABC, HyperStrategyMixin): if exit_: exit_signal = ExitType.EXIT_SIGNAL else: - trade_type = "exit_short" if trade.is_short else "sell" custom_reason = strategy_safe_wrapper(self.custom_exit, default_retval=False)( pair=trade.pair, trade=trade, current_time=date, current_rate=current_rate, current_profit=current_profit) @@ -805,8 +804,8 @@ class IStrategy(ABC, HyperStrategyMixin): exit_signal = ExitType.CUSTOM_EXIT if isinstance(custom_reason, str): if len(custom_reason) > CUSTOM_EXIT_MAX_LENGTH: - logger.warning(f'Custom {trade_type} reason returned from ' - f'custom_{trade_type} is too long and was trimmed' + logger.warning(f'Custom exit reason returned from ' + f'custom_exit is too long and was trimmed' f'to {CUSTOM_EXIT_MAX_LENGTH} characters.') custom_reason = custom_reason[:CUSTOM_EXIT_MAX_LENGTH] else: diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index cf70ea078..bdd470b47 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -507,7 +507,8 @@ def test_custom_exit(default_conf, fee, caplog) -> None: assert res.exit_type == ExitType.CUSTOM_EXIT assert res.exit_flag is True assert res.exit_reason == 'h' * 64 - assert log_has_re('Custom exit reason returned from custom_exit is too long.*', caplog) + assert log_has_re( + 'Custom exit reason returned from custom_exit is too long.*', caplog) @pytest.mark.parametrize('side', TRADE_SIDES)