@emin63's recent issue #108 has reminded me that the way ledger-autosync determines the offsetting account could be improved. Currently, we rely heavily on matching with Ledger's payee field. The current process goes something like this:
- Get payee field from imported file.
- Map payee to an existing Ledger payee, if applicable, by finding a matching
AutosyncPayee tag.
- Using the modified (or original) payee, look up the appropriate offsetting account.
The problem is that steps 2 and 3 aren't really tied together, but I might have several different kinds of transactions that have the same payee. For example, at my bank, I might have a cash withdrawal:
2020/01/01 * My Bank
; AutosyncPayee: CASH WITHDRAW
Assets:My Bank:Checking $-20.00
; ofxid: ...
Assets:Cash $20.00
Interest earned:
2020/01/01 * My Bank
; AutosyncPayee: INTEREST
Assets:My Bank:Savings $2.00
; ofxid: ...
Income:Interest $-2.00
A credit card payment (to a card owned by the same bank):
2020/01/01 * My Bank
; AutosyncPayee: CREDIT CARD PAYMENT
Assets:My Bank:Checking $-100.00
; ofxid: ...
Liabilities:My CC $-100.00
and so on. But as it is now, the offsetting account for all three types of transactions will be determined by whichever transaction appears with an AutosyncPayee tag most recently in my Ledgerfile. (And in my case, this is almost guaranteed to not be what I want, because I add AutosyncPayee values only as I find new transactions that need them, which means the most recent is most likely to be the least-frequent type of transaction.)
As the solution that appears the most obvious to me, should ledger-autosync instead tie steps 2 and 3 together, so that for my last example transaction, it considers not just transactions from My Bank, but from My Bank that have an AutosyncPayee of CREDIT CARD PAYMENT?
@emin63's recent issue #108 has reminded me that the way
ledger-autosyncdetermines the offsetting account could be improved. Currently, we rely heavily on matching with Ledger's payee field. The current process goes something like this:AutosyncPayeetag.The problem is that steps 2 and 3 aren't really tied together, but I might have several different kinds of transactions that have the same payee. For example, at my bank, I might have a cash withdrawal:
Interest earned:
A credit card payment (to a card owned by the same bank):
and so on. But as it is now, the offsetting account for all three types of transactions will be determined by whichever transaction appears with an
AutosyncPayeetag most recently in my Ledgerfile. (And in my case, this is almost guaranteed to not be what I want, because I addAutosyncPayeevalues only as I find new transactions that need them, which means the most recent is most likely to be the least-frequent type of transaction.)As the solution that appears the most obvious to me, should
ledger-autosyncinstead tie steps 2 and 3 together, so that for my last example transaction, it considers not just transactions fromMy Bank, but fromMy Bankthat have anAutosyncPayeeofCREDIT CARD PAYMENT?