hledger-flow: electrum: fix calculating 'No Data'

If electrum-provided prices aren't available, 'No Data' will be given.
Attempts to calculate this string will result in 0.00 for fiat values.

Do not attempt to calculate this string. Instead, leave the column empty
(for bitcoin.tax calculations).
This commit is contained in:
2024-09-09 19:07:54 -07:00
parent fb07eb33cf
commit c65c31659c

View File

@@ -52,11 +52,24 @@ function parse()
value=$4-$6 # Remove fee
printf("%.8f", value); printf OFS
sub(/^-/, "", $5)
printf("%.8f", $5); printf OFS # fiat_value
# fiat_value
if ($5 !~ /^No Data$/)
{
sub(/^-/, "", $5)
printf("%.8f", $5)
}
printf OFS
printf("%.8f", $6); printf OFS # fee
printf("%.8f", $7); printf OFS # fiat_fee
# fee
printf("%.8f", $6)
printf OFS
# fiat_fee
if ($7 !~ /^No Data$/)
{
printf("%.8f", $7)
}
printf OFS
# timestamp
sub(/ /, "T", $8) # HACK: makes arg-friendly by removing space