From d6572e1387852f76c2d393ae631b7e7fee7076f0 Mon Sep 17 00:00:00 2001 From: kwaaak Date: Wed, 7 Jun 2017 14:18:14 +0200 Subject: [PATCH] Update BitcoinAverage API to v2 --- lib/exchange_rate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py index d95edf3e..2673ae69 100644 --- a/lib/exchange_rate.py +++ b/lib/exchange_rate.py @@ -89,8 +89,8 @@ class ExchangeBase(PrintError): class BitcoinAverage(ExchangeBase): def get_rates(self, ccy): - json = self.get_json('api.bitcoinaverage.com', '/ticker/global/all') - return dict([(r, Decimal(json[r]['last'])) + json = self.get_json('apiv2.bitcoinaverage.com', '/indices/global/ticker/short') + return dict([(r.replace("BTC", ""), Decimal(json[r]['last'])) for r in json if r != 'timestamp']) def history_ccys(self): @@ -99,8 +99,8 @@ class BitcoinAverage(ExchangeBase): 'ZAR'] def historical_rates(self, ccy): - history = self.get_csv('api.bitcoinaverage.com', - "/history/%s/per_day_all_time_history.csv" % ccy) + history = self.get_csv('apiv2.bitcoinaverage.com', + "/indices/global/history/BTC%s?period=alltime&format=csv" % ccy) return dict([(h['DateTime'][:10], h['Average']) for h in history])