[1.03.20] Volume mapping and daily averaging fixes

This commit is contained in:
andrewso 2020-03-01 22:59:41 +00:00
parent e803153e51
commit 454add09f2
3 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ def bitfinexHighLowVol(type):
high = round(float(response[0][9]), 3)
low = round(float(response[0][10]), 3)
vol = round(float(response[0][8]), 3)
vol = round(float((response[0][8]))/24, 3)
return high, low, vol
except KeyError as e:

View File

@ -82,10 +82,10 @@ def sendToGateway(c_type, timestamp, av_price, high, low, vol, o_price, c_price)
with open(btc_usd, 'r') as file:
data = file.read()
timestamp = '"'+timestamp.strftime('%Y-%m-%dT%H:%M:%S+00:00')+'"'
timestamp = '"'+timestamp.strftime('%Y-%m-%dT%H:%M:%S')+'"'
type = '"'+c_type+'"'
query = data % (timestamp, type, av_price, high, low, vol, o_price, c_price)
query = data % (timestamp, type, av_price, high, low, o_price, c_price, vol)
print(query)
@ -101,7 +101,6 @@ def getOpenClose(type):
open, close = geminiOpenClose(type)
return open, close
# Dynamically Spin up Child process for each type wanting to track
def collector(c_type):
print("Console: ", "== Historical Price Collector ==")

View File

@ -10,8 +10,9 @@ def geminiPublicTicker(type):
response = requests.request("GET", uri)
response = json.loads(response.text)
price = float(response['last']) + float(response['ask']) + float(response['bid'])/3
price = (float(response['last']) + float(response['ask']) + float(response['bid']))/3
price = round(price, 3)
return price
except KeyError as e:
print("Gemini Spot Price Error: %s" % str(e))
@ -32,7 +33,7 @@ def geminiHighLowVol(type):
uri = "https://api.gemini.com/v1/pubticker/" + type.lower().replace('_', '')
response = requests.request("GET", uri)
response = json.loads(response.text)
vol = float(response['volume']['USD'])
vol = float(response['volume']['BTC'])/24
return high, low, vol
except KeyError as e: