howeyc / ledger

Command line double-entry accounting program
https://howeyc.github.io/ledger/
ISC License
455 stars 43 forks source link

Import matching existing transactions #35

Closed porjo closed 2 years ago

porjo commented 2 years ago

While importing, I've noticed that if I have two transactions on the same day where payee starts with the same word, only one of them is imported. I can see from the code that it does a simple match against the first word of the payee field. It would be good to improve that e.g use Bayesian classifier on payee string, or simple match on the first 2-3 words?

howeyc commented 2 years ago

Yeah, I have that for when I import credit card transactions. When downloading "current transactions" a few days apart I may get transactions I already imported before. That check is to keep from importing the same transaction twice.

You can use the --allow-matching flag to import transactions without doing this check.

porjo commented 2 years ago

I can see that --allow-matching would be the solution if it were a situation where multiple identical transactions were being made on the same day. In my case however the only common element is the first word - the remaining payee string and amounts are different. Would you consider extending the simple match to consider first and second word (if it exists)? In my case, that solves the issue.

howeyc commented 2 years ago

I think I'm going to change it to do a full payee match, the whole string.