diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index 8978117e9..61081157b 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -551,6 +551,10 @@ class ApiServer(RPC): timeframe = request.args.get("timeframe") timerange = request.args.get("timerange") strategy = request.args.get("strategy") + + if not pair or not timeframe or not timerange or not strategy: + return self.rest_error("Mandatory parameter missing.") + config = deepcopy(self._config) config.update({ 'strategy': strategy, @@ -575,4 +579,4 @@ class ApiServer(RPC): strategy_objs = StrategyResolver.search_all_objects(directory, False) strategy_objs = sorted(strategy_objs, key=lambda x: x['name']) - return self.rest_dump([x['name'] for x in strategy_objs]) + return self.rest_dump({'strategies': [x['name'] for x in strategy_objs]}) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index fc46d0a7f..fbee1cf64 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -877,4 +877,4 @@ def test_api_strategies(botclient): rc = client_get(client, f"{BASE_URI}/strategies") assert_response(rc) - assert rc.json == ['DefaultStrategy', 'TestStrategyLegacy'] + assert rc.json == {'strategies': ['DefaultStrategy', 'TestStrategyLegacy']}