From 8175fd207ebf8559843284f6cf2920538ef5d4ad Mon Sep 17 00:00:00 2001 From: Gert Wohlgemuth Date: Thu, 24 May 2018 00:49:06 -0700 Subject: [PATCH] more jyperopt fine tuning --- freqtrade/aws/strategy.py | 10 +++++++--- freqtrade/tests/aws/test_strategy_lambda.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/freqtrade/aws/strategy.py b/freqtrade/aws/strategy.py index f555032f6..d6b7f4fcc 100644 --- a/freqtrade/aws/strategy.py +++ b/freqtrade/aws/strategy.py @@ -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 diff --git a/freqtrade/tests/aws/test_strategy_lambda.py b/freqtrade/tests/aws/test_strategy_lambda.py index 62c6ad72e..413706819 100644 --- a/freqtrade/tests/aws/test_strategy_lambda.py +++ b/freqtrade/tests/aws/test_strategy_lambda.py @@ -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