Closed paxperscientiam closed 7 years ago
You can do the following:
ledger-autosync -l c/tsac.journal 2015.06.01—2017.06.04_c.QFX >> c/tsac.journal
At least, that works for me.
Does that work for you?
Short answer: yes.
Long answer:
So, it has since become clear to me that "includes" are parsed by ledger-autosync as well. This, renders the issue of adding the same transactions multiple times moot. This, though, assumes that stdout is redirected to a file that is already included -- include path/to/child.ledger
-- in the main ledger file.
For example:
main.ledger
and child.ledger
child.ledger
as inclusion.
include ./path/to/child.ledger
transactions.ofx
transactions.ofx
exists in either main.ledger
or child.ledger
, it will not be output by ledger-autosync.That is really cool.
Maybe I'm overly worried about the end-user, but my concern is that ">>" is one typo away from ">". Some may have noclobber
set, but I'm not sure how common that is.
At any rate, maybe this is more of a fringe concern than I had originally thought
@paxperscientiam I'm actually a little confused about what you want to do.
ledger-autosync relies on ledger/hledger to find the old transactions. It basically just runs ledger
with the right search query to find the old transactions. So it will process any includes, etc. that ledger will.
If you are running ledger-autosync against a local OFX or CSV file, ledger-autosync does assume that transactions are not repeated within the file. If they are, or course you will get duplicate transactions, but ledger-autosync should only generate 1 output transactions per input transaction.
If you are using the OFX protocol, ledger-autosync will request transactions for period of time from your bank. It will request larger and larger time increments until it sees transactions that it has seen before. It then processes all the transactions within that time period, outputting only the transactions that are not present in your ledger files already.
I use ledger-autosync by outputting to a temp file and then copying the entries over to my ledger files. This works perfectly for me.
Hi @egh,
I think I was operating on misunderstandings; I take full responsibility for the confusion :)
Thank you for clarifying how ledger and ledger-autosync interface. It helps a lot.
See you at the next issue!
Great, thank you!
Hello,
So, ledger-autosync can crosscheck journal files with OFX/QFX to prevent generating output for transactions that already exist in said journal files.
Can not this be further leveraged to add transactions to an existent journal file?
Currently, one can do something like this:
The problem with this is that there is no accounting for whether or not the transactions written into this journal file are already present. Hence, it would be awesome or there were some option to intelligently append transactions.
Thanks. Let me know if that's unclear.