added support for more metadata in the strategy
This commit is contained in:
parent
92155b11eb
commit
b5a67d44d3
@ -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)
|
||||||
|
@ -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'))
|
||||||
|
@ -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,6 +15,23 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user