|
@@ -3,6 +3,7 @@ import psycopg2.extras
|
|
|
import stocks
|
|
import stocks
|
|
|
from dotenv import load_dotenv
|
|
from dotenv import load_dotenv
|
|
|
import os
|
|
import os
|
|
|
|
|
+import sys
|
|
|
from pprint import pprint
|
|
from pprint import pprint
|
|
|
from datetime import datetime
|
|
from datetime import datetime
|
|
|
from urllib.parse import urlencode
|
|
from urllib.parse import urlencode
|
|
@@ -41,6 +42,14 @@ cursor.execute(query)
|
|
|
res = cursor.fetchone()
|
|
res = cursor.fetchone()
|
|
|
timestamp_latest = res.timestamp
|
|
timestamp_latest = res.timestamp
|
|
|
|
|
|
|
|
|
|
+with open('timestamp.txt', 'w+') as f:
|
|
|
|
|
+ timestamp_stored = f.read() or 0
|
|
|
|
|
+ if timestamp_latest != timestamp_stored:
|
|
|
|
|
+ f.write("{}".format(timestamp_latest))
|
|
|
|
|
+ else:
|
|
|
|
|
+ # Exit when there is nothing to do
|
|
|
|
|
+ sys.exit()
|
|
|
|
|
+
|
|
|
print(timestamp_previous)
|
|
print(timestamp_previous)
|
|
|
print(timestamp_latest)
|
|
print(timestamp_latest)
|
|
|
|
|
|