working database handling

This commit is contained in:
Gert Wohlgemuth 2018-05-20 11:47:48 -07:00
parent 74533be01e
commit a040181c26
3 changed files with 30 additions and 3 deletions

View File

@ -49,6 +49,15 @@ def performance(event, context):
pass pass
def get(event, context):
"""
loads a strategy
:param event:
:param context:
:return:
"""
pass
def code(event, context): def code(event, context):
""" """
returns the code of the requested strategy, if it's public returns the code of the requested strategy, if it's public

View File

@ -73,7 +73,7 @@ class TestStrategy(IStrategy):
"description": "simple test strategy", "description": "simple test strategy",
"name": "TestStrategy", "name": "TestStrategy",
"content": urlsafe_b64encode(content.encode('utf-8')), "content": urlsafe_b64encode(content.encode('utf-8')),
"public": False "public": True
} }
aws.submit({ aws.submit({
@ -89,7 +89,7 @@ class TestStrategy(IStrategy):
"description": "simple test strategy", "description": "simple test strategy",
"name": "TestStrategy", "name": "TestStrategy",
"content": urlsafe_b64encode(content.encode('utf-8')), "content": urlsafe_b64encode(content.encode('utf-8')),
"public": False "public": True
} }
aws.submit({ aws.submit({
@ -97,3 +97,20 @@ class TestStrategy(IStrategy):
}, {}) }, {})
assert (len(json.loads(aws.names({}, {})['body'])) == 2) 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

View File

@ -105,12 +105,13 @@ functions:
handler: freqtrade/aws/strategy.performance handler: freqtrade/aws/strategy.performance
events: events:
- http: - http:
path: strategies/{name}/performance path: strategies/{user}/{name}/performance
method: get method: get
cors: true cors: true
request: request:
parameter: parameter:
paths: paths:
user: true
name: true name: true
environment: environment: