Strategies should be a nested object
This commit is contained in:
parent
32e6ea314c
commit
6a59740f83
@ -551,6 +551,10 @@ class ApiServer(RPC):
|
|||||||
timeframe = request.args.get("timeframe")
|
timeframe = request.args.get("timeframe")
|
||||||
timerange = request.args.get("timerange")
|
timerange = request.args.get("timerange")
|
||||||
strategy = request.args.get("strategy")
|
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 = deepcopy(self._config)
|
||||||
config.update({
|
config.update({
|
||||||
'strategy': strategy,
|
'strategy': strategy,
|
||||||
@ -575,4 +579,4 @@ class ApiServer(RPC):
|
|||||||
strategy_objs = StrategyResolver.search_all_objects(directory, False)
|
strategy_objs = StrategyResolver.search_all_objects(directory, False)
|
||||||
strategy_objs = sorted(strategy_objs, key=lambda x: x['name'])
|
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]})
|
||||||
|
@ -877,4 +877,4 @@ def test_api_strategies(botclient):
|
|||||||
rc = client_get(client, f"{BASE_URI}/strategies")
|
rc = client_get(client, f"{BASE_URI}/strategies")
|
||||||
|
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
assert rc.json == ['DefaultStrategy', 'TestStrategyLegacy']
|
assert rc.json == {'strategies': ['DefaultStrategy', 'TestStrategyLegacy']}
|
||||||
|
Loading…
Reference in New Issue
Block a user