commit fe32d051d17814e587d5b28ec4973e2a1ba7b60b
parent cd6ec773c9b3e91bb7ac823ad7a86d30bc28f077
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 16 Jan 2016 12:53:59 +0100
Merge pull request #1627 from fhirschmann/kraken_plugin
Add Kraken exchange to exchange_rate plugin
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git 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',