mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
Merge branch 'master' of git://github.com/spesmilo/electrum
This commit is contained in:
commit
bf8bbfb2c0
1 changed files with 9 additions and 9 deletions
|
@ -70,7 +70,7 @@ class Exchanger(threading.Thread):
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
return btc_amount * decimal.Decimal(str(resp_rate["bpi"][str(quote_currency)]["rate_float"]))
|
return btc_amount * decimal.Decimal(str(resp_rate["bpi"][str(quote_currency)]["rate_float"]))
|
||||||
return btc_amount * decimal.Decimal(quote_currencies[quote_currency])
|
return btc_amount * decimal.Decimal(str(quote_currencies[quote_currency]))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
|
@ -126,7 +126,7 @@ class Exchanger(threading.Thread):
|
||||||
lenprices = len(winkresp["prices"])
|
lenprices = len(winkresp["prices"])
|
||||||
usdprice = winkresp["prices"][lenprices-1]["y"]
|
usdprice = winkresp["prices"][lenprices-1]["y"]
|
||||||
try:
|
try:
|
||||||
quote_currencies["USD"] = decimal.Decimal(usdprice)
|
quote_currencies["USD"] = decimal.Decimal(str(usdprice))
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.quote_currencies = quote_currencies
|
self.quote_currencies = quote_currencies
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -141,7 +141,7 @@ class Exchanger(threading.Thread):
|
||||||
quote_currencies = {"CAD": 0.0}
|
quote_currencies = {"CAD": 0.0}
|
||||||
cadprice = jsonresp["last"]
|
cadprice = jsonresp["last"]
|
||||||
try:
|
try:
|
||||||
quote_currencies["CAD"] = decimal.Decimal(cadprice)
|
quote_currencies["CAD"] = decimal.Decimal(str(cadprice))
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.quote_currencies = quote_currencies
|
self.quote_currencies = quote_currencies
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -156,7 +156,7 @@ class Exchanger(threading.Thread):
|
||||||
quote_currencies = {"CNY": 0.0}
|
quote_currencies = {"CNY": 0.0}
|
||||||
cnyprice = jsonresp["ticker"]["last"]
|
cnyprice = jsonresp["ticker"]["last"]
|
||||||
try:
|
try:
|
||||||
quote_currencies["CNY"] = decimal.Decimal(cnyprice)
|
quote_currencies["CNY"] = decimal.Decimal(str(cnyprice))
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.quote_currencies = quote_currencies
|
self.quote_currencies = quote_currencies
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -291,7 +291,7 @@ class Plugin(BasePlugin):
|
||||||
def init(self):
|
def init(self):
|
||||||
self.win = self.gui.main_window
|
self.win = self.gui.main_window
|
||||||
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
||||||
self.btc_rate = Decimal(0.0)
|
self.btc_rate = Decimal("0.0")
|
||||||
# Do price discovery
|
# Do price discovery
|
||||||
self.exchanger = Exchanger(self)
|
self.exchanger = Exchanger(self)
|
||||||
self.exchanger.start()
|
self.exchanger.start()
|
||||||
|
@ -309,7 +309,7 @@ class Plugin(BasePlugin):
|
||||||
def create_quote_text(self, btc_balance):
|
def create_quote_text(self, btc_balance):
|
||||||
quote_currency = self.config.get("currency", "EUR")
|
quote_currency = self.config.get("currency", "EUR")
|
||||||
self.exchanger.use_exchange = self.config.get("use_exchange", "Blockchain")
|
self.exchanger.use_exchange = self.config.get("use_exchange", "Blockchain")
|
||||||
cur_rate = self.exchanger.exchange(Decimal(1.0), quote_currency)
|
cur_rate = self.exchanger.exchange(Decimal("1.0"), quote_currency)
|
||||||
if cur_rate is None:
|
if cur_rate is None:
|
||||||
quote_text = ""
|
quote_text = ""
|
||||||
else:
|
else:
|
||||||
|
@ -376,12 +376,12 @@ class Plugin(BasePlugin):
|
||||||
tx_time = int(tx_info['timestamp'])
|
tx_time = int(tx_info['timestamp'])
|
||||||
tx_time_str = datetime.datetime.fromtimestamp(tx_time).strftime('%Y-%m-%d')
|
tx_time_str = datetime.datetime.fromtimestamp(tx_time).strftime('%Y-%m-%d')
|
||||||
try:
|
try:
|
||||||
tx_USD_val = "%.2f %s" % (Decimal(tx_info['value']) / 100000000 * Decimal(resp_hist['bpi'][tx_time_str]), "USD")
|
tx_USD_val = "%.2f %s" % (Decimal(str(tx_info['value'])) / 100000000 * Decimal(resp_hist['bpi'][tx_time_str]), "USD")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
tx_USD_val = "%.2f %s" % (self.btc_rate * Decimal(tx_info['value'])/100000000 , "USD")
|
tx_USD_val = "%.2f %s" % (self.btc_rate * Decimal(str(tx_info['value']))/100000000 , "USD")
|
||||||
|
|
||||||
item.setText(5, tx_USD_val)
|
item.setText(5, tx_USD_val)
|
||||||
if Decimal(tx_info['value']) < 0:
|
if Decimal(str(tx_info['value'])) < 0:
|
||||||
item.setForeground(5, QBrush(QColor("#BC1E1E")))
|
item.setForeground(5, QBrush(QColor("#BC1E1E")))
|
||||||
|
|
||||||
for i, width in enumerate(self.gui.main_window.column_widths['history']):
|
for i, width in enumerate(self.gui.main_window.column_widths['history']):
|
||||||
|
|
Loading…
Add table
Reference in a new issue