tAdd JPY exchange rate (#4016) - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 122cb08dc6f9c7b649283725f871a7d2a14ce418 DIR parent 81666bf9ac8b42d0ac25415ee3815d899c8adda6 HTML Author: 脇山P <wakiyamap@gmail.com> Date: Mon, 5 Mar 2018 20:08:10 +0900 Add JPY exchange rate (#4016) Diffstat: M lib/currencies.json | 14 +++++++++++--- M lib/exchange_rate.py | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) --- DIR diff --git a/lib/currencies.json b/lib/currencies.json t@@ -798,5 +798,14 @@ "RUB", "USD" ], - "itBit": [] -} -\ No newline at end of file + "itBit": [], + "Bitbank": [ + "JPY" + ], + "BitFlyer": [ + "JPY" + ], + "Zaif": [ + "JPY" + ] + } DIR diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py t@@ -160,6 +160,20 @@ class BitcoinVenezuela(ExchangeBase): "/historical/index.php?coin=BTC")[ccy +'_BTC'] +class Bitbank(ExchangeBase): + + def get_rates(self, ccy): + json = self.get_json('public.bitbank.cc', '/btc_jpy/ticker') + return {'JPY': Decimal(json['data']['last'])} + + +class BitFlyer(ExchangeBase): + + def get_rates(self, ccy): + json = self.get_json('bitflyer.jp', '/api/echo/price') + return {'JPY': Decimal(json['mid'])} + + class Bitmarket(ExchangeBase): def get_rates(self, ccy): t@@ -350,6 +364,12 @@ class Winkdex(ExchangeBase): for h in history]) +class Zaif(ExchangeBase): + def get_rates(self, ccy): + json = self.get_json('api.zaif.jp', '/api/1/last_price/btc_jpy') + return {'JPY': Decimal(json['last_price'])} + + def dictinvert(d): inv = {} for k, vlist in d.items():