From 92a08a5fe7d2ead8938e02d2621f1dbd6a176b4c Mon Sep 17 00:00:00 2001 From: sha-265 <4103710+sha-265@users.noreply.github.com> Date: Fri, 22 Dec 2023 12:03:58 +0200 Subject: [PATCH] Add Bit2C exchange (#8767) * Add Bit2C exchange * Remove whitespace --------- Co-authored-by: sha-265 --- electrum/currencies.json | 3 +++ electrum/exchange_rate.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) 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):