diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 19c90fff0..7c9be89aa 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -649,7 +649,8 @@ class RPC: trades = Trade.get_open_trades() return { 'current': len(trades), - 'max': float(self._freqtrade.config['max_open_trades']), + 'max': (int(self._freqtrade.config['max_open_trades']) + if self._freqtrade.config['max_open_trades'] != float('inf') else -1), 'total_stake': sum((trade.open_rate * trade.amount) for trade in trades) } diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 2212d4a79..4eb9a6fc8 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -364,14 +364,19 @@ def test_api_count(botclient, mocker, ticker, fee, markets): assert_response(rc) assert rc.json()["current"] == 0 - assert rc.json()["max"] == 1.0 + assert rc.json()["max"] == 1 # Create some test data ftbot.enter_positions() rc = client_get(client, f"{BASE_URI}/count") assert_response(rc) - assert rc.json()["current"] == 1.0 - assert rc.json()["max"] == 1.0 + assert rc.json()["current"] == 1 + assert rc.json()["max"] == 1 + + ftbot.config['max_open_trades'] = float('inf') + rc = client_get(client, f"{BASE_URI}/count") + assert rc.json()["max"] == -1 + def test_api_locks(botclient):