howeyc / ledger

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

import matching #32

Closed porjo closed 2 years ago

porjo commented 2 years ago

I'm using import function and found that the auto matching of transations to accounts isn't working well for some transactions.

I took a look at the code and can see that it will match accounts using the --set-search value (which defaults to Expense). In my case however, matching works better if I skip that filter i.e. comment this line and consider all account names when attempting to match. That way it picks up transactions from Income accounts (e.g. salary) and Asset accounts (internal transfers).

Would it make sense to include a flag to skip the --set-search value comparison?

howeyc commented 2 years ago

Another option which isn't intuitive, but might work is to do --set-search "" as all strings contain the empty string.

porjo commented 2 years ago

Thanks, good idea. I have another problem however. Sometimes the best match is the same account as the CSV data, so I end up with a transaction where positive and negative are against the same account! I created a fix in this branch which seems to work: https://github.com/howeyc/ledger/compare/master...porjo:import_fix but not sure if that's the best approach.

howeyc commented 2 years ago

LGTM