[1.03.20] Volume mapping and daily averaging fixes
This commit is contained in:
parent
e803153e51
commit
454add09f2
@ -29,7 +29,7 @@ def bitfinexHighLowVol(type):
|
|||||||
|
|
||||||
high = round(float(response[0][9]), 3)
|
high = round(float(response[0][9]), 3)
|
||||||
low = round(float(response[0][10]), 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
|
return high, low, vol
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
|
|||||||
@ -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:
|
with open(btc_usd, 'r') as file:
|
||||||
data = file.read()
|
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+'"'
|
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)
|
print(query)
|
||||||
|
|
||||||
@ -101,7 +101,6 @@ def getOpenClose(type):
|
|||||||
open, close = geminiOpenClose(type)
|
open, close = geminiOpenClose(type)
|
||||||
return open, close
|
return open, close
|
||||||
|
|
||||||
|
|
||||||
# Dynamically Spin up Child process for each type wanting to track
|
# Dynamically Spin up Child process for each type wanting to track
|
||||||
def collector(c_type):
|
def collector(c_type):
|
||||||
print("Console: ", "== Historical Price Collector ==")
|
print("Console: ", "== Historical Price Collector ==")
|
||||||
|
|||||||
@ -10,8 +10,9 @@ def geminiPublicTicker(type):
|
|||||||
response = requests.request("GET", uri)
|
response = requests.request("GET", uri)
|
||||||
response = json.loads(response.text)
|
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)
|
price = round(price, 3)
|
||||||
|
|
||||||
return price
|
return price
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
print("Gemini Spot Price Error: %s" % str(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('_', '')
|
uri = "https://api.gemini.com/v1/pubticker/" + type.lower().replace('_', '')
|
||||||
response = requests.request("GET", uri)
|
response = requests.request("GET", uri)
|
||||||
response = json.loads(response.text)
|
response = json.loads(response.text)
|
||||||
vol = float(response['volume']['USD'])
|
vol = float(response['volume']['BTC'])/24
|
||||||
|
|
||||||
return high, low, vol
|
return high, low, vol
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user