diff --git a/electrum/currencies.json b/electrum/currencies.json index d9d4fdac7..dd3d3d9b3 100644 --- a/electrum/currencies.json +++ b/electrum/currencies.json @@ -2,6 +2,9 @@ "BitFlyer": [ "JPY" ], + "Bit2C": [ + "ILS" + ], "BitPay": [ "AED", "AFN", diff --git a/electrum/exchange_rate.py b/electrum/exchange_rate.py index 0dc78cfec..5cae92fcb 100644 --- a/electrum/exchange_rate.py +++ b/electrum/exchange_rate.py @@ -358,6 +358,23 @@ class CoinGecko(ExchangeBase): for h in history['prices']]) +class Bit2C(ExchangeBase): + + async def get_rates(self, ccy): + json = await self.get_json('bit2c.co.il', '/Exchanges/BtcNis/Ticker.json') + return {'ILS': to_decimal(json['ll'])} + + def history_ccys(self): + return CURRENCIES[self.name()] + + async def request_history(self, ccy): + history = await self.get_json('bit2c.co.il', + '/Exchanges/BtcNis/KLines?resolution=1D&from=1357034400&to=%s' % int(time.time())) + + return dict([(datetime.utcfromtimestamp(h[0]).strftime('%Y-%m-%d'), str(h[6])) + for h in history]) + + class CointraderMonitor(ExchangeBase): async def get_rates(self, ccy):