From 1975e942d68177286f54af33904da1c86290e6af Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 1 Nov 2022 18:58:04 +0000 Subject: [PATCH] Add test for no remaining (kucoin case - https://github.com/freqtrade/freqtrade/issues/7757). --- tests/rpc/test_rpc.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index 8725ad2c5..ef6c8b204 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -156,9 +156,25 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None: 'filled': 0.0, 'remaining': 91.07468123 }) - assert results[0] == response_unfilled + # Open order without remaining + trade = Trade.get_open_trades()[0] + # kucoin case (no remaining set). + trade.orders[0].remaining = None + Trade.commit() + + results = rpc._rpc_trade_status() + # Reuse above object, only remaining changed. + response_unfilled['orders'][0].update({ + 'remaining': None + }) + assert results[0] == response_unfilled + + trade = Trade.get_open_trades()[0] + trade.orders[0].remaining = trade.amount + Trade.commit() + # Fill open order ... freqtradebot.manage_open_orders() trades = Trade.get_open_trades()