From ffff45e76bb1e647f17f5f8711664ba4985f2de2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 10 Apr 2022 08:37:35 +0200 Subject: [PATCH] simplify exit message --- freqtrade/strategy/interface.py | 3 +-- tests/strategy/test_interface.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index ebaa6568f..ba2eb9636 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -885,7 +885,6 @@ class IStrategy(ABC, HyperStrategyMixin): if exit_ and not enter: 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=current_time, current_rate=current_rate, current_profit=current_profit) @@ -893,7 +892,7 @@ 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 ' + 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] diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index 44a17ac02..a86d69135 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -523,7 +523,7 @@ 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 sell 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)