From c2da8eb46df44f820ebe2715abe5d8d6dd83aeaa Mon Sep 17 00:00:00 2001 From: WakiyamaP Date: Sun, 4 Mar 2018 04:48:08 +0900 Subject: [PATCH] Add JPY exchange rate --- lib/currencies.json | 13 +++++++++++-- lib/exchange_rate.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/currencies.json b/lib/currencies.json index a4e85f1f..62efefdc 100644 --- a/lib/currencies.json +++ b/lib/currencies.json @@ -798,5 +798,14 @@ "RUB", "USD" ], - "itBit": [] -} \ No newline at end of file + "itBit": [], + "Bitbank": [ + "JPY" + ], + "Bitflyer": [ + "JPY" + ], + "Zaif": [ + "JPY" + ] +} diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py index 02ed91b9..526a71ff 100644 --- a/lib/exchange_rate.py +++ b/lib/exchange_rate.py @@ -159,6 +159,19 @@ class BitcoinVenezuela(ExchangeBase): return self.get_json('api.bitcoinvenezuela.com', "/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): @@ -350,6 +363,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():