commit bd3bfb5e535b59f2ad2f0450f4e5a2ce600f2a7b
parent 9efc25bdba3d56d13dfc79975cf228afcec85e00
Author: ThomasV <thomasv1@gmx.de>
Date: Sun, 27 Jul 2014 07:59:37 +0200
Merge pull request #773 from wozz/itbit-exchange
Add itbit exchange to exchange rate plugin
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/plugins/exchange_rate.py b/plugins/exchange_rate.py
@@ -25,6 +25,7 @@ EXCHANGES = ["BitcoinAverage",
"CaVirtEx",
"Coinbase",
"CoinDesk",
+ "itBit",
"LocalBitcoins",
"Winkdex"]
@@ -74,6 +75,12 @@ class Exchanger(threading.Thread):
except Exception:
return
return btc_amount * decimal.Decimal(str(resp_rate["bpi"][str(quote_currency)]["rate_float"]))
+ elif self.use_exchange == "itBit":
+ try:
+ resp_rate = self.get_json('www.itbit.com', "/api/feeds/ticker/XBT" + str(quote_currency))
+ except Exception:
+ return
+ return btc_amount * decimal.Decimal(str(resp_rate["bid"]))
return btc_amount * decimal.Decimal(str(quote_currencies[quote_currency]))
def stop(self):
@@ -92,6 +99,7 @@ class Exchanger(threading.Thread):
"CaVirtEx": self.update_cv,
"CoinDesk": self.update_cd,
"Coinbase": self.update_cb,
+ "itBit": self.update_ib,
"LocalBitcoins": self.update_lb,
"Winkdex": self.update_wd,
}
@@ -121,6 +129,15 @@ class Exchanger(threading.Thread):
self.quote_currencies = quote_currencies
self.parent.set_currencies(quote_currencies)
+ def update_ib(self):
+ available_currencies = ["USD", "EUR", "SGD"]
+ quote_currencies = {}
+ for cur in available_currencies:
+ quote_currencies[cur] = 0.0
+ with self.lock:
+ self.quote_currencies = quote_currencies
+ self.parent.set_currencies(quote_currencies)
+
def update_wd(self):
try:
winkresp = self.get_json('winkdex.com', "/api/v0/price")