commit 95d3f6da1fefcda9c0dbf2bbfac71094dfe2ec3f
parent 76465aa6bdb6465404ad4adf5cd561771decbe62
Author: Neil Booth <kyuupichan@gmail.com>
Date: Sun, 6 Sep 2015 00:54:05 +0900
A couple of fixes
- Give hook correct name
- Use spot if no data and today - tx_date <= 2 because of timezone
differences.
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/plugins/exchange_rate.py b/plugins/exchange_rate.py
@@ -262,7 +262,6 @@ class Plugin(BasePlugin, ThreadJob):
'''Called when the chosen currency changes'''
ccy = str(self.ccy_combo.currentText())
if ccy and ccy != self.ccy:
- print "Setting:", ccy
self.ccy = ccy
self.config.set_key('currency', ccy, True)
self.update_status_bars()
@@ -348,10 +347,9 @@ class Plugin(BasePlugin, ThreadJob):
rate = self.exchange.historical_rate(ccy, d_t)
# Frequently there is no rate for today, until tomorrow :)
# Use spot quotes in that case
- if rate is None and d_t.date() == datetime.today().date():
+ if rate is None and (datetime.today().date() - d_t.date()).days <= 2:
rate = self.exchange.quotes.get(ccy)
- if rate is not None:
- self.history_used_spot = True
+ self.history_used_spot = True
if rate:
value = round(Decimal(satoshis) / COIN * Decimal(rate), 2)
return " ".join(["{:,.2f}".format(value), ccy])
@@ -362,7 +360,7 @@ class Plugin(BasePlugin, ThreadJob):
headers.extend([_('Fiat Amount'), _('Fiat Balance')])
@hook
- def history_tab_update(self):
+ def history_tab_update_begin(self):
self.history_used_spot = False
@hook