slowly working on the endpoints

This commit is contained in:
Gert Wohlgemuth
2018-05-14 16:46:10 -07:00
parent b680429ea1
commit 94acbf6c57
4 changed files with 145 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
from freqtrade.strategy.resolver import StrategyResolver
import simplejson as json
from jsonschema import validate
from freqtrade.aws.schemas import __SUBMIT_STRATEGY_SCHEMA__
from base64 import urlsafe_b64decode
def names(event, context):
"""
@@ -31,9 +37,23 @@ def code(event, context):
def submit(event, context):
"""
combiles the given strategy and stores it in the internal database
compiles the given strategy and stores it in the internal database
:param event:
:param context:
:return:
"""
# get data
data = json.loads(event['body'])
# validate against schema
validate(data, __SUBMIT_STRATEGY_SCHEMA__)
strategy = urlsafe_b64decode(data['content']).decode('utf-8')
# try to load the strategy
StrategyResolver().compile(data['name'], strategy)
# save to DB
pass