Open livtanong opened 2 years ago
Could you say a little more about how/why you are using diff ? I am inexperienced with it.
For the record, since unclear in docs, the current CLI is
hledger diff -f FILE1 -f FILE2 FULLACCOUNTNAME
Every month, I cross-check my credit card billing statement against my ledger. One of the way I speed up this process is hledger diff
. This lets me easily find charges I forgot to record, mistakes in encoding some of these charges, and even credit card fraud.
However, this system isn't perfect, because if I forgot to record a recurring charge, (for example, Netflix for this month, phone bill, utilities, etc...) it will eagerly match against any past transaction entry containing the same amount.
For example
Say it is 2021-12-31, and I received my credit card statement saying I owe 1000 USD for the month of December. I run diff
on this statement and my ledger, and it reports there are no missing transactions. I check my ledger, and my records say I owe 995 USD rather than 1000 USD. What accounts for the missing 5 USD when the diff
says there are no missing transactions? After careful digging, I find that I forgot to to record my Netflix charge for 5 USD posted on 2021-12-10. It wasn't detected as missing, because a similar record exists the previous month, dated 2021-11-10. This is because diff
's search space is the entire ledger.
Being able to limit how far back in history hledger searches for a matching transaction will make diff
a lot more useful in this regard.
EDIT: a detailed example
Currently,
diff
ignores both date and description. This is sensible.However, this means regular transactions like monthly bills (i.e. netflix, spotify, etc...) are wrongly ignored. Exact date matching is of course impractical, but a date range/filter (say, within the span of 28 days) will allow hledger to ignore transactions outside this filter for the purposes of diffing.
A perhaps more composable way of implementing this is a way to filter the journal to only consider transactions within a certain date. I imagine this might already exist, but I haven't found it. (Most of what i've found have involved reports)