diff --git a/src/pricing/bitfinex.py b/src/pricing/bitfinex.py index 8899d8c..9b5f4af 100644 --- a/src/pricing/bitfinex.py +++ b/src/pricing/bitfinex.py @@ -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: diff --git a/src/pricing/collector.py b/src/pricing/collector.py index 5718139..591be5a 100644 --- a/src/pricing/collector.py +++ b/src/pricing/collector.py @@ -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 ==") diff --git a/src/pricing/gemini.py b/src/pricing/gemini.py index 99556dd..cd65c07 100644 --- a/src/pricing/gemini.py +++ b/src/pricing/gemini.py @@ -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: