Skip to content

Commit ca4e4ef

Browse files
committed
test: Add test scenario for partially filled exit
* followed by exit_timeout_count * shouldn't place order for the full amount part of freqtrade#12343
1 parent 96c65da commit ca4e4ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/freqtradebot/test_freqtradebot.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,18 @@ def test_manage_open_orders_exit_usercustom(
22672267
freqtrade.manage_open_orders()
22682268
assert log_has_re("Emergency exiting trade.*", caplog)
22692269
assert et_mock.call_count == 1
2270+
# Full exit
2271+
assert et_mock.call_args_list[0][1]["sub_trade_amt"] == 30
2272+
2273+
et_mock.reset_mock()
2274+
2275+
# Full partially filled order
2276+
# Only places the order for the remaining amount
2277+
limit_sell_order_old["remaining"] = open_trade_usdt.amount - 10
2278+
freqtrade.manage_open_orders()
2279+
assert log_has_re("Emergency exiting trade.*", caplog)
2280+
assert et_mock.call_count == 1
2281+
assert et_mock.call_args_list[0][1]["sub_trade_amt"] == 20.0
22702282

22712283

22722284
@pytest.mark.parametrize("is_short", [False, True])

0 commit comments

Comments
 (0)