diff --git a/freqtrade/aws/strategy.py b/freqtrade/aws/strategy.py index e190744e9..7d55445c7 100644 --- a/freqtrade/aws/strategy.py +++ b/freqtrade/aws/strategy.py @@ -49,6 +49,15 @@ def performance(event, context): pass +def get(event, context): + """ + loads a strategy + :param event: + :param context: + :return: + """ + pass + def code(event, context): """ returns the code of the requested strategy, if it's public diff --git a/freqtrade/tests/aws/test_strategy_lambda.py b/freqtrade/tests/aws/test_strategy_lambda.py index 6541aca03..f7e46a776 100644 --- a/freqtrade/tests/aws/test_strategy_lambda.py +++ b/freqtrade/tests/aws/test_strategy_lambda.py @@ -73,7 +73,7 @@ class TestStrategy(IStrategy): "description": "simple test strategy", "name": "TestStrategy", "content": urlsafe_b64encode(content.encode('utf-8')), - "public": False + "public": True } aws.submit({ @@ -89,7 +89,7 @@ class TestStrategy(IStrategy): "description": "simple test strategy", "name": "TestStrategy", "content": urlsafe_b64encode(content.encode('utf-8')), - "public": False + "public": True } aws.submit({ @@ -97,3 +97,20 @@ class TestStrategy(IStrategy): }, {}) assert (len(json.loads(aws.names({}, {})['body'])) == 2) + + # we need to be able to get the code of the strategy + code = aws.code({'pathParameters': { + "name": "TestStrategy", + "user": "GCU4LW2XXZW3A3FM2XZJTEJHNWHTWDKY2DIJLCZJ5ULVZ4K7LZ7D23TH" + }}, {}) + + # code should equal our initial content + assert code == content + + # we need to be able to get a strategy ( code cannot be included ) + strategy = json.loads(aws.get({}, {})) + assert "content" not in strategy + assert "user" in strategy + assert "name" in strategy + assert "description" in strategy + assert "public" in strategy diff --git a/serverless.yml b/serverless.yml index 46c45aa15..a6a9891c0 100644 --- a/serverless.yml +++ b/serverless.yml @@ -105,12 +105,13 @@ functions: handler: freqtrade/aws/strategy.performance events: - http: - path: strategies/{name}/performance + path: strategies/{user}/{name}/performance method: get cors: true request: parameter: paths: + user: true name: true environment: