1
0

computation of capital gains for outgoing transactions

This commit is contained in:
ThomasV
2018-01-06 12:57:04 +01:00
parent c32435c15e
commit 42a16d9c3e
3 changed files with 52 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
fx = self.parent.fx
if fx and fx.show_history():
headers.extend(['%s '%fx.ccy + _('Amount'), '%s '%fx.ccy + _('Balance')])
headers.extend(['%s '%fx.ccy + _('Capital Gains')])
self.update_headers(headers)
def get_domain(self):
@@ -91,6 +92,10 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
for amount in [value, balance]:
text = fx.historical_value_str(amount, date)
entry.append(text)
# fixme: should use is_mine
if value < 0:
cg = self.wallet.capital_gain(tx_hash, self.parent.fx.timestamp_rate)
entry.append("%.2f"%cg if cg is not None else _('No data'))
item = QTreeWidgetItem(entry)
item.setIcon(0, icon)
item.setToolTip(0, str(conf) + " confirmation" + ("s" if conf != 1 else ""))