Browse Source

Update BitcoinAverage API to v2

2.9.x
kwaaak 8 years ago
committed by GitHub
parent
commit
d6572e1387
  1. 8
      lib/exchange_rate.py

8
lib/exchange_rate.py

@ -89,8 +89,8 @@ class ExchangeBase(PrintError):
class BitcoinAverage(ExchangeBase): class BitcoinAverage(ExchangeBase):
def get_rates(self, ccy): def get_rates(self, ccy):
json = self.get_json('api.bitcoinaverage.com', '/ticker/global/all') json = self.get_json('apiv2.bitcoinaverage.com', '/indices/global/ticker/short')
return dict([(r, Decimal(json[r]['last'])) return dict([(r.replace("BTC", ""), Decimal(json[r]['last']))
for r in json if r != 'timestamp']) for r in json if r != 'timestamp'])
def history_ccys(self): def history_ccys(self):
@ -99,8 +99,8 @@ class BitcoinAverage(ExchangeBase):
'ZAR'] 'ZAR']
def historical_rates(self, ccy): def historical_rates(self, ccy):
history = self.get_csv('api.bitcoinaverage.com', history = self.get_csv('apiv2.bitcoinaverage.com',
"/history/%s/per_day_all_time_history.csv" % ccy) "/indices/global/history/BTC%s?period=alltime&format=csv" % ccy)
return dict([(h['DateTime'][:10], h['Average']) return dict([(h['DateTime'][:10], h['Average'])
for h in history]) for h in history])

Loading…
Cancel
Save