From ca4e4efeb8ccdf10ac4a99084270cc9e54cfde20 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 7 Oct 2025 06:48:35 +0200 Subject: [PATCH] test: Add test scenario for partially filled exit * followed by exit_timeout_count * shouldn't place order for the full amount part of #12343 --- tests/freqtradebot/test_freqtradebot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/freqtradebot/test_freqtradebot.py b/tests/freqtradebot/test_freqtradebot.py index 1304ca9ba..1360f2d77 100644 --- a/tests/freqtradebot/test_freqtradebot.py +++ b/tests/freqtradebot/test_freqtradebot.py @@ -2267,6 +2267,18 @@ def test_manage_open_orders_exit_usercustom( freqtrade.manage_open_orders() assert log_has_re("Emergency exiting trade.*", caplog) assert et_mock.call_count == 1 + # Full exit + assert et_mock.call_args_list[0][1]["sub_trade_amt"] == 30 + + et_mock.reset_mock() + + # Full partially filled order + # Only places the order for the remaining amount + limit_sell_order_old["remaining"] = open_trade_usdt.amount - 10 + freqtrade.manage_open_orders() + assert log_has_re("Emergency exiting trade.*", caplog) + assert et_mock.call_count == 1 + assert et_mock.call_args_list[0][1]["sub_trade_amt"] == 20.0 @pytest.mark.parametrize("is_short", [False, True])