From a7e12f000b260a87e313aa6c268b0432aceafd2a Mon Sep 17 00:00:00 2001 From: Dimitri Kaparis Date: Sat, 25 Sep 2021 02:21:09 +0300 Subject: [PATCH] Initial commit --- README.md | 7 +++++++ ec-export.sh | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 README.md create mode 100755 ec-export.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..e84fba7 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +Electron Cash export history script + +Exports CSV history in specified date range + +Usage: ec-export.sh + +Example: ec-export.sh ~/.electron-cash/wallets/default_wallet 2021-08-01 2021-08-31 diff --git a/ec-export.sh b/ec-export.sh new file mode 100755 index 0000000..9a679ea --- /dev/null +++ b/ec-export.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# ec-export.sh + +echo transaction_hash,label,confirmations,value,fee,timestamp,fiat_value_EUR,fiat_balance_EUR,fiat_fee_EUR,input_addresses,output_addresses +electron-cash history -w $1 --show_fiat --use_net | +jq -r 'map({txid,"label",confirmations,value,fee,timestamp,fiat_value,fiat_balance,fiat_fee}) | (first | keys_unsorted) as $keys | map([to_entries[] | .value]) as $rows | $keys,$rows[] | @csv' | +gawk -vFPAT='[^,]*|"[^"]*"' -v OFS="," '{ $6 = strftime("%Y-%m-%d %H:%M",$6); if($6>="'$2'" && $6<="'$3'") {print}}'