Re-add Fiat Balance column
This commit is contained in:
parent
1171a25815
commit
915ee94cdd
@ -60,12 +60,6 @@ class ExchangeBase:
|
|||||||
rate = self.history.get(ccy, {}).get(d_t.strftime('%Y-%m-%d'))
|
rate = self.history.get(ccy, {}).get(d_t.strftime('%Y-%m-%d'))
|
||||||
return rate
|
return rate
|
||||||
|
|
||||||
def historical_value_str(self, ccy, satoshis, d_t):
|
|
||||||
rate = self.historical_rate(ccy, d_t)
|
|
||||||
if rate:
|
|
||||||
value = round(Decimal(satoshis) / COIN * Decimal(rate), 2)
|
|
||||||
return " ".join(["{:,.2f}".format(value), ccy])
|
|
||||||
return _("No data")
|
|
||||||
|
|
||||||
class BitcoinAverage(ExchangeBase):
|
class BitcoinAverage(ExchangeBase):
|
||||||
def update(self, ccy):
|
def update(self, ccy):
|
||||||
@ -310,9 +304,16 @@ class Plugin(BasePlugin, ThreadJob):
|
|||||||
def requires_settings(self):
|
def requires_settings(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def historical_value_str(self, ccy, satoshis, d_t):
|
||||||
|
rate = self.exchange.historical_rate(ccy, d_t)
|
||||||
|
if rate:
|
||||||
|
value = round(Decimal(satoshis) / COIN * Decimal(rate), 2)
|
||||||
|
return " ".join(["{:,.2f}".format(value), ccy])
|
||||||
|
return _("No data")
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def history_tab_headers(self, headers):
|
def history_tab_headers(self, headers):
|
||||||
headers.append(_('Fiat Amount'))
|
headers.extend([_('Fiat Amount'), _('Fiat Balance')])
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def history_tab_update(self, tx, entry):
|
def history_tab_update(self, tx, entry):
|
||||||
@ -322,8 +323,9 @@ class Plugin(BasePlugin, ThreadJob):
|
|||||||
date = timestamp_to_datetime(timestamp)
|
date = timestamp_to_datetime(timestamp)
|
||||||
if not date:
|
if not date:
|
||||||
date = timestamp_to_datetime(0)
|
date = timestamp_to_datetime(0)
|
||||||
text = self.exchange.historical_value_str(self.fiat_unit(), value, date)
|
for amount in [value, balance]:
|
||||||
entry.append("%16s"%text)
|
text = self.historical_value_str(self.fiat_unit(), amount, date)
|
||||||
|
entry.append("%16s" % text)
|
||||||
|
|
||||||
def settings_widget(self, window):
|
def settings_widget(self, window):
|
||||||
return EnterButton(_('Settings'), self.settings_dialog)
|
return EnterButton(_('Settings'), self.settings_dialog)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user