mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
Add itbit exchange to exchange rate plugin
This commit is contained in:
parent
9efc25bdba
commit
27ddfcdd36
1 changed files with 17 additions and 0 deletions
|
@ -25,6 +25,7 @@ EXCHANGES = ["BitcoinAverage",
|
||||||
"CaVirtEx",
|
"CaVirtEx",
|
||||||
"Coinbase",
|
"Coinbase",
|
||||||
"CoinDesk",
|
"CoinDesk",
|
||||||
|
"itBit",
|
||||||
"LocalBitcoins",
|
"LocalBitcoins",
|
||||||
"Winkdex"]
|
"Winkdex"]
|
||||||
|
|
||||||
|
@ -74,6 +75,12 @@ 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"]))
|
||||||
|
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]))
|
return btc_amount * decimal.Decimal(str(quote_currencies[quote_currency]))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
@ -92,6 +99,7 @@ class Exchanger(threading.Thread):
|
||||||
"CaVirtEx": self.update_cv,
|
"CaVirtEx": self.update_cv,
|
||||||
"CoinDesk": self.update_cd,
|
"CoinDesk": self.update_cd,
|
||||||
"Coinbase": self.update_cb,
|
"Coinbase": self.update_cb,
|
||||||
|
"itBit": self.update_ib,
|
||||||
"LocalBitcoins": self.update_lb,
|
"LocalBitcoins": self.update_lb,
|
||||||
"Winkdex": self.update_wd,
|
"Winkdex": self.update_wd,
|
||||||
}
|
}
|
||||||
|
@ -121,6 +129,15 @@ class Exchanger(threading.Thread):
|
||||||
self.quote_currencies = quote_currencies
|
self.quote_currencies = quote_currencies
|
||||||
self.parent.set_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):
|
def update_wd(self):
|
||||||
try:
|
try:
|
||||||
winkresp = self.get_json('winkdex.com', "/api/v0/price")
|
winkresp = self.get_json('winkdex.com', "/api/v0/price")
|
||||||
|
|
Loading…
Add table
Reference in a new issue