From e6ab8b5ddf6c38674cc2c11bc65dc81f9ddc6ef3 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Wed, 29 May 2024 19:22:15 -0700 Subject: [PATCH] hledger-flow: gemini: allow optional on-chain transfers Fixes "does not exist as a named header in the given CSV data." when on-chain transfer does not (yet) exist for given year. --- .../hledger-flow/accounts/gemini/gemini-shared.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/container/src/hledger-flow/accounts/gemini/gemini-shared.bash b/container/src/hledger-flow/accounts/gemini/gemini-shared.bash index a509ffd..0dc3651 100755 --- a/container/src/hledger-flow/accounts/gemini/gemini-shared.bash +++ b/container/src/hledger-flow/accounts/gemini/gemini-shared.bash @@ -50,11 +50,15 @@ function parse_transfers() if lib_preprocess::test_header "info_feeCurrency"; then - _header="info_eid,info_timestampms,info_type,info_currency,info_feeCurrency,info_amount,info_feeAmount,info_destination,info_txHash" - # Off-chain withdrawal + _header="info_eid,info_timestampms,info_type,info_currency,info_feeCurrency,info_amount,info_feeAmount" + + # On-chain + lib_preprocess::test_header "info_destination" && _header+=",info_destination" + lib_preprocess::test_header "info_txHash" && _header+=",info_txHash" + + # Off-chain (withdrawal) lib_preprocess::test_header "info_method" && _header+=",info_method" - # NOTE: this hack in a sort because docker-finance's fetch (or their server's) pagination. See fetch implementation. xsv select "$_header" "$global_in_path" \ | gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -M -v PREC=100 \ '{