electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit a3554dc2b7838b130becd004385b003a0fc79a63
parent 51630416fc2e1b7bdea2e008f3f8f42d40fdd615
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 27 Feb 2018 16:00:56 +0100

fix #3963

Diffstat:
Mgui/qt/history_list.py | 8+++-----
Mlib/exchange_rate.py | 2++
Mlib/wallet.py | 10++++------
3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py @@ -143,18 +143,16 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): h = self.summary start_date = h.get('start_date') end_date = h.get('end_date') - if start_date is None or end_date is None: - self.parent.show_message(_("Nothing to summarize.")) - return format_amount = lambda x: self.parent.format_amount(x.value) + ' ' + self.parent.base_unit() + format_date = lambda x: x.isoformat(' ')[:-3] if x else _("None") d = WindowModalDialog(self, _("Summary")) d.setMinimumSize(600, 150) vbox = QVBoxLayout() grid = QGridLayout() grid.addWidget(QLabel(_("Start")), 0, 0) - grid.addWidget(QLabel(start_date.isoformat(' ')), 0, 1) + grid.addWidget(QLabel(format_date(start_date)), 0, 1) grid.addWidget(QLabel(_("End")), 1, 0) - grid.addWidget(QLabel(end_date.isoformat(' ')), 1, 1) + grid.addWidget(QLabel(format_date(end_date)), 1, 1) grid.addWidget(QLabel(_("Initial balance")), 2, 0) grid.addWidget(QLabel(format_amount(h['start_balance'])), 2, 1) grid.addWidget(QLabel(str(h.get('start_fiat_balance'))), 2, 2) diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py @@ -520,6 +520,8 @@ class FxThread(ThreadJob): return "%s" % (self.ccy_amount_str(value, True)) def history_rate(self, d_t): + if d_t is None: + return Decimal('NaN') rate = self.exchange.historical_rate(self.ccy, d_t) # Frequently there is no rate for today, until tomorrow :) # Use spot quotes in that case diff --git a/lib/wallet.py b/lib/wallet.py @@ -1055,8 +1055,8 @@ class Abstract_Wallet(PrintError): start_date = timestamp_to_datetime(from_timestamp) end_date = timestamp_to_datetime(to_timestamp) else: - start_date = out[0]['date'] - end_date = out[-1]['date'] + start_date = None + end_date = None summary = { 'start_date': start_date, 'end_date': end_date, @@ -1071,10 +1071,8 @@ class Abstract_Wallet(PrintError): summary['fiat_income'] = Fiat(fiat_income, fx.ccy) summary['fiat_expenditures'] = Fiat(fiat_expenditures, fx.ccy) summary['unrealized_gains'] = Fiat(unrealized, fx.ccy) - if start_date: - summary['start_fiat_balance'] = Fiat(fx.historical_value(start_balance, start_date), fx.ccy) - if end_date: - summary['end_fiat_balance'] = Fiat(fx.historical_value(end_balance, end_date), fx.ccy) + summary['start_fiat_balance'] = Fiat(fx.historical_value(start_balance, start_date), fx.ccy) + summary['end_fiat_balance'] = Fiat(fx.historical_value(end_balance, end_date), fx.ccy) else: summary = {} return {