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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user