diff --git a/config_examples/config_full.example.json b/config_examples/config_full.example.json index 164e38f67..d361b5b00 100644 --- a/config_examples/config_full.example.json +++ b/config_examples/config_full.example.json @@ -149,7 +149,7 @@ "trailing_stop_loss": "off", "stop_loss": "off", "stoploss_on_exchange": "off", - "custom_sell": "off" + "custom_exit": "off" }, "sell_fill": "on", "buy_cancel": "on", diff --git a/docs/telegram-usage.md b/docs/telegram-usage.md index b84c21c65..5433fe23b 100644 --- a/docs/telegram-usage.md +++ b/docs/telegram-usage.md @@ -90,7 +90,7 @@ Example configuration showing the different settings: "trailing_stop_loss": "on", "stop_loss": "on", "stoploss_on_exchange": "on", - "custom_sell": "silent" + "custom_exit": "silent" }, "buy_cancel": "silent", "sell_cancel": "on", diff --git a/freqtrade/enums/exittype.py b/freqtrade/enums/exittype.py index fb5c7110b..a2aa89305 100644 --- a/freqtrade/enums/exittype.py +++ b/freqtrade/enums/exittype.py @@ -12,7 +12,7 @@ class ExitType(Enum): SELL_SIGNAL = "sell_signal" FORCE_EXIT = "force_exit" EMERGENCY_EXIT = "emergency_exit" - CUSTOM_SELL = "custom_sell" + CUSTOM_EXIT = "custom_exit" NONE = "" def __str__(self): diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 7dc21a6b1..332f0c499 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -529,7 +529,7 @@ class Backtesting: # call the custom exit price,with default value as previous closerate current_profit = trade.calc_profit_ratio(closerate) order_type = self.strategy.order_types['exit'] - if sell.exit_type in (ExitType.SELL_SIGNAL, ExitType.CUSTOM_SELL): + if sell.exit_type in (ExitType.SELL_SIGNAL, ExitType.CUSTOM_EXIT): # Custom exit pricing only for sell-signals if order_type == 'limit': closerate = strategy_safe_wrapper(self.strategy.custom_exit_price, diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index a488b1a28..f9f04f5b5 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -895,7 +895,7 @@ class IStrategy(ABC, HyperStrategyMixin): pair=trade.pair, trade=trade, current_time=current_time, current_rate=current_rate, current_profit=current_profit) if custom_reason: - exit_signal = ExitType.CUSTOM_SELL + 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 ' @@ -904,7 +904,7 @@ class IStrategy(ABC, HyperStrategyMixin): custom_reason = custom_reason[:CUSTOM_EXIT_MAX_LENGTH] else: custom_reason = None - if exit_signal in (ExitType.CUSTOM_SELL, ExitType.SELL_SIGNAL): + if exit_signal in (ExitType.CUSTOM_EXIT, ExitType.SELL_SIGNAL): logger.debug(f"{trade.pair} - Sell signal received. " f"exit_type=ExitType.{exit_signal.name}" + (f", custom_reason={custom_reason}" if custom_reason else "")) diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index a5325a680..44a17ac02 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -503,15 +503,15 @@ def test_custom_exit(default_conf, fee, caplog) -> None: enter=False, exit_=False, low=None, high=None) assert res.exit_flag is True - assert res.exit_type == ExitType.CUSTOM_SELL - assert res.exit_reason == 'custom_sell' + assert res.exit_type == ExitType.CUSTOM_EXIT + assert res.exit_reason == 'custom_exit' strategy.custom_exit = MagicMock(return_value='hello world') res = strategy.should_exit(trade, 1, now, enter=False, exit_=False, low=None, high=None) - assert res.exit_type == ExitType.CUSTOM_SELL + assert res.exit_type == ExitType.CUSTOM_EXIT assert res.exit_flag is True assert res.exit_reason == 'hello world' @@ -520,7 +520,7 @@ def test_custom_exit(default_conf, fee, caplog) -> None: res = strategy.should_exit(trade, 1, now, enter=False, exit_=False, low=None, high=None) - assert res.exit_type == ExitType.CUSTOM_SELL + 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)