This commit is contained in:
EC2 Default User 2018-05-24 07:49:15 +00:00
commit 0895759239
2 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import os
import time
from base64 import urlsafe_b64decode
from base64 import urlsafe_b64decode, urlsafe_b64encode
import boto3
import simplejson as json
@ -185,8 +185,9 @@ def __evaluate(data):
lambda x: "#{} # this version does not support hyperopt!".format(x) if "hyperopt" in x else x,
strategy.split("\n"))))
# print("loaded strategy")
# print(strategy)
print("loaded strategy")
print(strategy)
# try to load the strategy
strat = StrategyResolver().compile(data['name'], strategy)
data['time'] = int(time.time() * 1000)
@ -195,6 +196,9 @@ def __evaluate(data):
data['stoploss'] = strat.stoploss
data['ticker'] = strat.ticker_interval
# ensure that the modified file is saved
data['content'] = urlsafe_b64encode(strategy.encode('utf-8'))
# default variables if not provided
if 'trailing_stop' not in data:
data['trailing_stop'] = False

View File

@ -112,8 +112,6 @@ class TestStrategy(IStrategy):
"name": "TestStrategy",
"user": "GCU4LW2XXZW3A3FM2XZJTEJHNWHTWDKY2DIJLCZJ5ULVZ4K7LZ7D23TH"
}}, {})
print(strategy)
strategy = json.loads(strategy['body'])
assert "content" not in strategy
@ -129,6 +127,9 @@ class TestStrategy(IStrategy):
"user": "GCU4LW2XXZW3A3FM2XZJTEJHNWHTWDKY2DIJLCZJ5ULVZ4K7LZ7D23TH"
}}, {})
print("code is")
print(code)
# code should equal our initial content
#assert code == content