import httplib
import json
import threading
+import time
import re
from decimal import Decimal
from electrum.plugins import BasePlugin
EXCHANGES = ["BitcoinAverage",
"BitcoinVenezuela",
+ "Bitcurex",
+ "Bitmarket",
"BitPay",
"Blockchain",
"BTCChina",
self.query_rates = threading.Event()
self.use_exchange = self.parent.config.get('use_exchange', "Blockchain")
self.parent.exchanges = EXCHANGES
- self.parent.currencies = ["EUR","GBP","USD"]
+ self.parent.currencies = ["EUR","GBP","USD","PLN"]
self.parent.win.emit(SIGNAL("refresh_exchanges_combo()"))
self.parent.win.emit(SIGNAL("refresh_currencies_combo()"))
self.is_running = False
update_rates = {
"BitcoinAverage": self.update_ba,
"BitcoinVenezuela": self.update_bv,
+ "Bitcurex": self.update_bx,
+ "Bitmarket": self.update_bm,
"BitPay": self.update_bp,
"Blockchain": self.update_bc,
"BTCChina": self.update_CNY,
pass
self.parent.set_currencies(quote_currencies)
+ def update_bm(self):
+ try:
+ jsonresp = self.get_json('www.bitmarket.pl', "/json/BTCPLN/ticker.json")
+ except Exception:
+ return
+ quote_currencies = {"PLN": 0.0}
+ pln_price = jsonresp["last"]
+ try:
+ quote_currencies["PLN"] = decimal.Decimal(str(pln_price))
+ with self.lock:
+ self.quote_currencies = quote_currencies
+ except KeyError:
+ pass
+ self.parent.set_currencies(quote_currencies)
+
+ def update_bx(self):
+ try:
+ jsonresp = self.get_json('pln.bitcurex.com', "/data/ticker.json")
+ except Exception:
+ return
+ quote_currencies = {"PLN": 0.0}
+ pln_price = jsonresp["last"]
+ try:
+ quote_currencies["PLN"] = decimal.Decimal(str(pln_price))
+ with self.lock:
+ self.quote_currencies = quote_currencies
+ except KeyError:
+ pass
+ self.parent.set_currencies(quote_currencies)
+
def update_CNY(self):
try:
jsonresp = self.get_json('data.btcchina.com', "/data/ticker")
if quote:
price_text = "1 BTC~%s"%quote
fiat_currency = quote[-3:]
- btc_price = quote[:-4]
+ btc_price = self.btc_rate
fiat_balance = Decimal(btc_price) * (Decimal(btc_balance)/100000000)
balance_text = "(%.2f %s)" % (fiat_balance,fiat_currency)
text = " " + balance_text + " " + price_text + " "
newtx = self.wallet.get_tx_history()
v = newtx[[x[0] for x in newtx].index(str(item.data(0, Qt.UserRole).toPyObject()))][3]
- tx_info = {'timestamp':int(datetime.datetime.now().strftime("%s")), 'value': v }
+ tx_info = {'timestamp':int(time.time()), 'value': v }
pass
tx_time = int(tx_info['timestamp'])
if cur_exchange == "CoinDesk":