This commit is contained in:
EC2 Default User 2018-06-06 00:22:38 +00:00
commit c5ab479c32
3 changed files with 20 additions and 4 deletions

View File

@ -215,7 +215,7 @@ def _store_aggregated_data(interval, name, result, timerange, user):
"losses": row[6], "losses": row[6],
"wins": row[5], "wins": row[5],
"duration": row[4], "duration": row[4],
"profit_percent": row[2], "profit_percent": row[2]
} }
print(data) print(data)

View File

@ -199,7 +199,6 @@ def __evaluate(data):
data['type'] = "strategy" data['type'] = "strategy"
data['roi'] = strat.minimal_roi data['roi'] = strat.minimal_roi
data['stoploss'] = strat.stoploss data['stoploss'] = strat.stoploss
data['ticker'] = strat.ticker_interval
# ensure that the modified file is saved # ensure that the modified file is saved
data['content'] = urlsafe_b64encode(strategy.encode('utf-8')) data['content'] = urlsafe_b64encode(strategy.encode('utf-8'))

View File

@ -1,7 +1,7 @@
import boto3 import boto3
import simplejson as json import simplejson as json
import os import os
from freqtrade.aws.tables import get_trade_table from freqtrade.aws.tables import get_trade_table, get_strategy_table
from boto3.dynamodb.conditions import Key, Attr from boto3.dynamodb.conditions import Key, Attr
@ -15,7 +15,24 @@ def store(event, context):
for x in event['Records']: for x in event['Records']:
if 'Sns' in x and 'Message' in x['Sns']: if 'Sns' in x and 'Message' in x['Sns']:
data = json.loads(x['Sns']['Message'], use_decimal=True) data = json.loads(x['Sns']['Message'], use_decimal=True)
get_trade_table().put_item(Item=data)
table = get_strategy_table()
response = table.query(
KeyConditionExpression=Key('user').eq(data['user']) &
Key('name').eq(data['strategy'])
)
if "Items" in response and len(response['Items']) > 0:
item = response['Items'][0]
data['strategy'] = {
"name": item['name'],
"user": item['user'],
"public": item['public']
}
get_trade_table().put_item(Item=data)
def submit(event, context): def submit(event, context):