tqt history export: include fiat value in csv - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 436f6a4870df4411c69dbca9f2bdacd5f63ba514 DIR parent 71ac3bb305c6622f8224323c56cba6d3a88a1dc6 HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 9 Nov 2018 18:48:12 +0100 qt history export: include fiat value in csv Diffstat: M electrum/gui/qt/history_list.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) --- DIR diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py t@@ -414,26 +414,29 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop): if not filename: return try: - self.do_export_history(self.wallet, filename, csv_button.isChecked()) + self.do_export_history(filename, csv_button.isChecked()) except (IOError, os.error) as reason: export_error_label = _("Electrum was unable to produce a transaction export.") self.parent.show_critical(export_error_label + "\n" + str(reason), title=_("Unable to export history")) return self.parent.show_message(_("Your wallet history has been successfully exported.")) - def do_export_history(self, wallet, fileName, is_csv): + def do_export_history(self, file_name, is_csv): history = self.transactions lines = [] - for item in history: - if is_csv: - lines.append([item['txid'], item.get('label', ''), item['confirmations'], item['value'], item['date']]) - else: - lines.append(item) - with open(fileName, "w+", encoding='utf-8') as f: + if is_csv: + for item in history: + lines.append([item['txid'], + item.get('label', ''), + item['confirmations'], + item['value'], + item.get('fiat_value', ''), + item['date']]) + with open(file_name, "w+", encoding='utf-8') as f: if is_csv: import csv transaction = csv.writer(f, lineterminator='\n') - transaction.writerow(["transaction_hash","label", "confirmations", "value", "timestamp"]) + transaction.writerow(["transaction_hash", "label", "confirmations", "value", "fiat_value", "timestamp"]) for line in lines: transaction.writerow(line) else: