diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 6eba88e67..e386f2ce3 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -474,7 +474,7 @@ CANCEL_REASON = { "FULLY_CANCELLED": "fully cancelled", "ALL_CANCELLED": "cancelled (all unfilled and partially filled open orders cancelled)", "CANCELLED_ON_EXCHANGE": "cancelled on exchange", - "FORCE_SELL": "forcesold", + "FORCE_EXIT": "forcesold", } # List of pairs with their timeframes diff --git a/freqtrade/enums/exittype.py b/freqtrade/enums/exittype.py index 10e61cb6c..823f40d1e 100644 --- a/freqtrade/enums/exittype.py +++ b/freqtrade/enums/exittype.py @@ -10,7 +10,7 @@ class ExitType(Enum): STOPLOSS_ON_EXCHANGE = "stoploss_on_exchange" TRAILING_STOP_LOSS = "trailing_stop_loss" EXIT_SIGNAL = "exit_signal" - FORCE_SELL = "force_exit" + FORCE_EXIT = "force_exit" EMERGENCY_SELL = "emergency_sell" CUSTOM_SELL = "custom_sell" NONE = "" diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 060fbbd0b..17a121ff2 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -542,7 +542,7 @@ class Backtesting: sell_row = data[pair][-1] trade.close_date = sell_row[DATE_IDX].to_pydatetime() - trade.exit_reason = ExitType.FORCE_SELL.value + trade.exit_reason = ExitType.FORCE_EXIT.value trade.close(sell_row[OPEN_IDX], show_msg=False) LocalTrade.close_bt_trade(trade) # Deepcopy object to have wallets update correctly diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 33d225739..3ef69e292 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -661,18 +661,18 @@ class RPC: if order['side'] == 'buy': fully_canceled = self._freqtrade.handle_cancel_enter( - trade, order, CANCEL_REASON['FORCE_SELL']) + trade, order, CANCEL_REASON['FORCE_EXIT']) if order['side'] == 'sell': # Cancel order - so it is placed anew with a fresh price. - self._freqtrade.handle_cancel_exit(trade, order, CANCEL_REASON['FORCE_SELL']) + self._freqtrade.handle_cancel_exit(trade, order, CANCEL_REASON['FORCE_EXIT']) if not fully_canceled: # Get current rate and execute sell closing_side = "buy" if trade.is_short else "sell" current_rate = self._freqtrade.exchange.get_rate( trade.pair, refresh=False, side=closing_side) - exit_reason = ExitCheckTuple(exit_type=ExitType.FORCE_SELL) + exit_reason = ExitCheckTuple(exit_type=ExitType.FORCE_EXIT) order_type = ordertype or self._freqtrade.strategy.order_types.get( "forcesell", self._freqtrade.strategy.order_types["sell"]) diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index b93f5a0e9..af5ac75c5 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -360,7 +360,7 @@ def test_hyperopt_format_results(hyperopt): "is_short": [False, False, False, False], "stake_amount": [0.01, 0.01, 0.01, 0.01], "exit_reason": [ExitType.ROI, ExitType.STOP_LOSS, - ExitType.ROI, ExitType.FORCE_SELL] + ExitType.ROI, ExitType.FORCE_EXIT] }), 'config': hyperopt.config, 'locks': [], @@ -429,7 +429,7 @@ def test_generate_optimizer(mocker, hyperopt_conf) -> None: "is_short": [False, False, False, False], "stake_amount": [0.01, 0.01, 0.01, 0.01], "exit_reason": [ExitType.ROI, ExitType.STOP_LOSS, - ExitType.ROI, ExitType.FORCE_SELL] + ExitType.ROI, ExitType.FORCE_EXIT] }), 'config': hyperopt_conf, 'locks': [], diff --git a/tests/optimize/test_optimize_reports.py b/tests/optimize/test_optimize_reports.py index 5cd3df3c6..ea2c5519b 100644 --- a/tests/optimize/test_optimize_reports.py +++ b/tests/optimize/test_optimize_reports.py @@ -79,7 +79,7 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmpdir): "is_short": [False, False, False, False], "stake_amount": [0.01, 0.01, 0.01, 0.01], "exit_reason": [ExitType.ROI, ExitType.STOP_LOSS, - ExitType.ROI, ExitType.FORCE_SELL] + ExitType.ROI, ExitType.FORCE_EXIT] }), 'config': default_conf, 'locks': [], @@ -128,7 +128,7 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmpdir): "is_short": [False, False, False, False], "stake_amount": [0.01, 0.01, 0.01, 0.01], "exit_reason": [ExitType.ROI, ExitType.ROI, - ExitType.STOP_LOSS, ExitType.FORCE_SELL] + ExitType.STOP_LOSS, ExitType.FORCE_EXIT] }), 'config': default_conf, 'locks': [], diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index df793c5ca..2ab5241c3 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -962,7 +962,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee, 'fiat_currency': 'USD', 'buy_tag': ANY, 'enter_tag': ANY, - 'exit_reason': ExitType.FORCE_SELL.value, + 'exit_reason': ExitType.FORCE_EXIT.value, 'open_date': ANY, 'close_date': ANY, 'close_rate': ANY, @@ -1030,7 +1030,7 @@ def test_telegram_forcesell_down_handle(default_conf, update, ticker, fee, 'fiat_currency': 'USD', 'buy_tag': ANY, 'enter_tag': ANY, - 'exit_reason': ExitType.FORCE_SELL.value, + 'exit_reason': ExitType.FORCE_EXIT.value, 'open_date': ANY, 'close_date': ANY, 'close_rate': ANY, @@ -1088,7 +1088,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None 'fiat_currency': 'USD', 'buy_tag': ANY, 'enter_tag': ANY, - 'exit_reason': ExitType.FORCE_SELL.value, + 'exit_reason': ExitType.FORCE_EXIT.value, 'open_date': ANY, 'close_date': ANY, 'close_rate': ANY,