Before this, I did not even bother to parse any monetary columns; I just copied them directly to the YNAB-import CSV, possibly adding a minus sign if it was an "Amount".
However, there is a need to support multiple monetary columns per statement row.
For example, a transaction column plus a fee column.
These must be summed to calculate the net flow and must therefore be parsed as numerical values.
Changes
Read monetary columns as Decimal values.
Decimal gives exact calculations without the rounding errors of floats, which is ideal in this context.
Configuration values for thousands separator and decimal point used for monetary columns.
These values are required in all bank configs.
Includes additional refactoring, such as more warnings and errors.
The test_identity test is actually a regression test for a bug I discovered that the other tests did not capture since they do not look at the output CSV. In any case, it's a sensible test to have.
Motivation
Before this, I did not even bother to parse any monetary columns; I just copied them directly to the YNAB-import CSV, possibly adding a minus sign if it was an "
Amount
". However, there is a need to support multiple monetary columns per statement row. For example, a transaction column plus a fee column. These must be summed to calculate the net flow and must therefore be parsed as numerical values.Changes
Decimal
values.Decimal
gives exact calculations without the rounding errors of floats, which is ideal in this context.test_identity
test is actually a regression test for a bug I discovered that the other tests did not capture since they do not look at the output CSV. In any case, it's a sensible test to have.