This commit is contained in:
EC2 Default User 2018-06-06 00:31:27 +00:00
commit ac653256d2
3 changed files with 12 additions and 20 deletions

View File

@ -215,7 +215,9 @@ 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],
"strategy": name,
"user": user
} }
print(data) print(data)
@ -238,7 +240,10 @@ def _store_trade_data(interval, name, result, timerange, user):
"profit_percent": row['profit_percent'], "profit_percent": row['profit_percent'],
"profit_stake": row['profit_BTC'], "profit_stake": row['profit_BTC'],
"entry_date": row['entry'].strftime('%Y-%m-%d %H:%M:%S'), "entry_date": row['entry'].strftime('%Y-%m-%d %H:%M:%S'),
"exit_date": row['exit'].strftime('%Y-%m-%d %H:%M:%S') "exit_date": row['exit'].strftime('%Y-%m-%d %H:%M:%S'),
"strategy": name,
"user": user
} }
print(data) print(data)

View File

@ -15,23 +15,6 @@ 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)
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) get_trade_table().put_item(Item=data)

View File

@ -258,6 +258,8 @@ functions:
strategyTable: ${self:custom.strategyTable} strategyTable: ${self:custom.strategyTable}
BASE_URL: https://${self:custom.customDomain.domainName}/${self:custom.customDomain.stage} BASE_URL: https://${self:custom.customDomain.domainName}/${self:custom.customDomain.stage}
reservedConcurrency: 1
# schedules all registered strategies on a daily base # schedules all registered strategies on a daily base
schedule: schedule:
memorySize: 128 memorySize: 128
@ -275,3 +277,5 @@ functions:
topic: ${self:custom.snsTopic} topic: ${self:custom.snsTopic}
tradeTable: ${self:custom.tradeTable} tradeTable: ${self:custom.tradeTable}
strategyTable: ${self:custom.strategyTable} strategyTable: ${self:custom.strategyTable}
reservedConcurrency: 1