From 23312cbcd168e64adbbeebebc49ce991cd165c7f Mon Sep 17 00:00:00 2001 From: Fabian Hirschmann Date: Wed, 13 Jan 2016 01:03:30 +0100 Subject: [PATCH] add Kraken exchange to exchange_rate plugin --- plugins/exchange_rate/exchange_rate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/exchange_rate/exchange_rate.py b/plugins/exchange_rate/exchange_rate.py index 7430e864..61d15fe2 100644 --- a/plugins/exchange_rate/exchange_rate.py +++ b/plugins/exchange_rate/exchange_rate.py @@ -229,6 +229,15 @@ class itBit(ExchangeBase): result[ccy] = Decimal(json['lastPrice']) return result +class Kraken(ExchangeBase): + def get_rates(self, ccy): + ccys = ['EUR', 'USD', 'CAD', 'GBP', 'JPY'] + pairs = ['XBT%s' % c for c in ccys] + json = self.get_json('api.kraken.com', + '/0/public/Ticker?pair=%s' % ','.join(pairs)) + return dict((k[-3:], Decimal(float(v['c'][0]))) + for k, v in json['result'].items()) + class LocalBitcoins(ExchangeBase): def get_rates(self, ccy): json = self.get_json('localbitcoins.com',