Adjusted quote lookup and added three more currencies (where we have translations for)

This commit is contained in:
Pontius 2013-01-04 10:35:21 +01:00
parent 344cb1ddb1
commit e590c1cb20
2 changed files with 5 additions and 6 deletions

View File

@ -36,9 +36,8 @@ class Exchanger(threading.Thread):
response = json.loads(response.read())
quote_currencies = {}
try:
quote_currencies["GBP"] = self._lookup_rate(response, "GBP")
quote_currencies["EUR"] = self._lookup_rate(response, "EUR")
quote_currencies["USD"] = self._lookup_rate(response, "USD")
for r in response:
quote_currencies[r] = self._lookup_rate(response, r)
with self.lock:
self.quote_currencies = quote_currencies
self.parent.emit(SIGNAL("refresh_balance()"))
@ -46,9 +45,9 @@ class Exchanger(threading.Thread):
pass
def _lookup_rate(self, response, quote_id):
return decimal.Decimal(response[str(quote_id)]["24h"])
return decimal.Decimal(response[str(quote_id)]["15m"])
if __name__ == "__main__":
exch = Exchanger(("EUR", "USD", "GBP"))
exch = Exchanger(("BRL", "CNY", "EUR", "GBP", "RUB", "USD"))
print exch.exchange(1, "EUR")

View File

@ -197,7 +197,7 @@ class MiniWindow(QDialog):
self.actuator = actuator
self.config = config
self.btc_balance = None
self.quote_currencies = ["EUR", "USD", "GBP"]
self.quote_currencies = ["BRL", "CNY", "EUR", "GBP", "RUB", "USD"]
self.actuator.set_configured_currency(self.set_quote_currency)
self.exchanger = exchange_rate.Exchanger(self)
# Needed because price discovery is done in a different thread