From 533672eab469dc06071e2a7865fcd56392b31dee Mon Sep 17 00:00:00 2001
From: TonyFord <tonyford@strategy-investor.de>
Date: Mon, 28 Jun 2021 13:27:07 +0200
Subject: [PATCH] add price update script

---
 price_update.py                                | 8 ++++++++
 services/jekyll/_data/price-sources/FAIRO.json | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 price_update.py

diff --git a/price_update.py b/price_update.py
new file mode 100644
index 0000000..5510750
--- /dev/null
+++ b/price_update.py
@@ -0,0 +1,8 @@
+import requests
+import json
+from datetime import datetime
+
+response = json.loads(requests.get('https://fairo.exchange/fair.json').text)
+if( response ):
+    response ['FAIRO']['timestamp']=datetime.now().timestamp()
+    open( './services/jekyll/_data/price-sources/FAIRO.json','w').write( json.dumps( response['FAIRO'] ) )
diff --git a/services/jekyll/_data/price-sources/FAIRO.json b/services/jekyll/_data/price-sources/FAIRO.json
index 682302d..48f5a5c 100644
--- a/services/jekyll/_data/price-sources/FAIRO.json
+++ b/services/jekyll/_data/price-sources/FAIRO.json
@@ -1 +1 @@
-{ "last":0.06412297 }
+{"last": 0.0582759, "timestamp": 1624606367.644424}
\ No newline at end of file
-- 
GitLab