Add itbit exchange to exchange rate plugin

This commit is contained in:
Michael Wozniak 2014-07-26 13:58:55 -04:00
parent 9efc25bdba
commit 27ddfcdd36
1 changed files with 17 additions and 0 deletions

View File

@ -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")