added datetime expiration to the trades table

This commit is contained in:
Gert Wohlgemuth 2018-06-07 17:10:44 -07:00
parent 63591fae9c
commit 69e4d863c4

View File

@ -1,3 +1,4 @@
import datetime
from time import sleep
import boto3
@ -21,7 +22,7 @@ def store(event, context):
for x in data:
print("storing data: {}".format(x))
sleep(0.5) # throttle to not overwhelm the DB, lambda is cheaper than dynamo
sleep(0.5) # throttle to not overwhelm the DB, lambda is cheaper than dynamo
get_trade_table().put_item(Item=x)
@ -35,6 +36,7 @@ def submit(event, context):
print(event)
data = json.loads(event['body'])
data['ttl'] = (datetime.datetime.today() + datetime.timedelta(days=1)).timestamp()
client = boto3.client('sns')
topic_arn = client.create_topic(Name=os.environ['tradeTopic'])['TopicArn']