fixed some minor issues
This commit is contained in:
parent
7b101f17b6
commit
6fa57da664
@ -59,7 +59,7 @@ def backtest(event, context):
|
||||
)
|
||||
|
||||
till = datetime.datetime.today()
|
||||
fromDate = till - datetime.timedelta(days=1)
|
||||
fromDate = till - datetime.timedelta(days=90)
|
||||
|
||||
if 'from' in event['body']:
|
||||
fromDate = datetime.datetime.strptime(event['body']['from'], '%Y%m%d')
|
||||
@ -69,7 +69,7 @@ def backtest(event, context):
|
||||
try:
|
||||
if "Items" in response and len(response['Items']) > 0:
|
||||
|
||||
print("schedule backtesting from {} till {} for {} with {} vs {}".format(fromDate, till, name,
|
||||
print("schedule back testing from {} till {} for {} with {} vs {}".format(fromDate, till, name,
|
||||
event['body'][
|
||||
'stake_currency'],
|
||||
event['body'][
|
||||
@ -129,7 +129,7 @@ def _submit_result_to_backend(data):
|
||||
"""
|
||||
print(data)
|
||||
try:
|
||||
print(post("{}/trade".format(os.environ['BASE_URL']), data=data))
|
||||
print(post("{}/trade".format(os.environ.get('BASE_URL', 'http://freq.isaac.international/dev/trade')), data=data))
|
||||
except Exception as e:
|
||||
print("submission ignored: {}".format(e))
|
||||
|
||||
@ -171,7 +171,7 @@ def _generate_configuration(event, fromDate, name, response, till):
|
||||
"chat_id": "0"
|
||||
},
|
||||
"initial_state": "running",
|
||||
"datadir": os.environ("FREQ_DATA_DIR", tempfile.gettempdir()),
|
||||
"datadir": tempfile.gettempdir(),
|
||||
"experimental": {
|
||||
"use_sell_signal": response['Items'][0]['use_sell'],
|
||||
"sell_profit_only": True
|
||||
@ -183,7 +183,7 @@ def _generate_configuration(event, fromDate, name, response, till):
|
||||
"loglevel": logging.INFO,
|
||||
"strategy": "{}:{}".format(name, content),
|
||||
"timerange": "{}-{}".format(fromDate.strftime('%Y%m%d'), till.strftime('%Y%m%d')),
|
||||
"refresh_pairs": True
|
||||
"refresh_pairs": False # no longer required, we will maintain static files for the future
|
||||
|
||||
}
|
||||
return configuration
|
||||
|
@ -63,15 +63,14 @@ class TestStrategy(IStrategy):
|
||||
"public": False
|
||||
}
|
||||
|
||||
# db should be empty
|
||||
assert (len(json.loads(aws.names({}, {})['body']['result'])) == 0)
|
||||
# now we add an entry
|
||||
aws.submit({
|
||||
"body": json.dumps(request)
|
||||
}, {})
|
||||
|
||||
# now we should have items
|
||||
assert (len(json.loads(aws.names({}, {})['body']['result'])) == 1)
|
||||
print(json.loads(aws.names({}, {})['body']))
|
||||
assert (len(json.loads(aws.names({}, {})['body'])['result']) == 1)
|
||||
|
||||
# able to add a second strategy with the sample name, but different user
|
||||
|
||||
@ -87,7 +86,7 @@ class TestStrategy(IStrategy):
|
||||
"body": json.dumps(request)
|
||||
}, {})
|
||||
|
||||
assert (len(json.loads(aws.names({}, {})['body']['result'])) == 2)
|
||||
assert (len(json.loads(aws.names({}, {})['body'])['result']) == 2)
|
||||
|
||||
# able to add a duplicated strategy, which should overwrite the existing strategy
|
||||
|
||||
@ -99,13 +98,11 @@ class TestStrategy(IStrategy):
|
||||
"public": True
|
||||
}
|
||||
|
||||
print(json.dumps(request))
|
||||
|
||||
aws.submit({
|
||||
"body": json.dumps(request)
|
||||
}, {})
|
||||
|
||||
assert (len(json.loads(aws.names({}, {})['body'])) == 2)
|
||||
assert (len(json.loads(aws.names({}, {})['body'])['result']) == 2)
|
||||
|
||||
# we need to be able to get a strategy ( code cannot be included )
|
||||
strategy = aws.get({'pathParameters': {
|
||||
@ -131,7 +128,7 @@ class TestStrategy(IStrategy):
|
||||
print(code)
|
||||
|
||||
# code should equal our initial content
|
||||
#assert code == content
|
||||
# assert code == content
|
||||
|
||||
# we are not allowed to load a private strategy
|
||||
code = aws.code({'pathParameters': {
|
||||
|
Loading…
Reference in New Issue
Block a user