Thanks for the replies. I am doing this for the first setup of my ledger. Nevertheless, I think I want the extraction reproducible, creating the ledger zero-to-present day each time the script is run. For that reason, I need an automated way for creating the open-account directives.
@fin that looks like what I need. I see the input to the function is a list of entries. But I am confused how to combine this with my multiple importers. In the way I have my script setup I do not have access to the combined output entries (only standalone entries per-each-importer). Since multiple importers can access the same account, this would create redundant open directives. Perhaps you see something wrong with my setup? Here it is: I actually copied the bean-extract.py source code ( ugh) into a bean-extract.py file which I launch from my IDE (so that i can attach debugger inside my importers). And then I just do `bean-extract.py config.import statements`. The contents of `config.import` is basically ``` CONFIG = [ bank1.Importer(), bank2.Importer() ] ``` so I do not actually have access to the "entries" such that I could insert them into the `auto_accounts` function. The ledger is output by `bean-extract` to console outside of my importers. I think I am doing something wrong; I should not have to modify stuff inside bean-extract, right? Dne pondělí 11. prosince 2023 v 10:56:27 UTC+1 uživatel Red S napsal: > I imagine this is for first time setup of your ledger. Many options exist. > Here's a simple way: get a list of all accounts missing open directives, > and place them into your ledger. You can do this by running bean-check (or > bean-query) and grepping for that error about missing directives. > > With my ledger having been setup and running, I only rarely add open > directives---once in a bluemoon. That's the point of open directives: > automation can book a transaction to an account I didn't manually open, and > therefore cause "leak." > > On Sunday, December 10, 2023 at 5:12:31 AM UTC-8 Petr Karvinsky wrote: > >> Hi everyone. I am having trouble understanding how are the open account >> directives created when using importers. >> >> I wrote a couple importers which work and the ledgers can be ingested by >> bean-web or interactive bean-query. I wnated to automatize my queries by >> running the non-interactive version or by running bean-report. However, my >> ledger (although working well with tools above) has a lot of errors: >> missing open directives. >> >> I checked multiple repositories with examples of how to solve this but >> full-text search never finds anything matching "open" in the source codes. >> So, how do these open instructions appear in people's ledgers? Are you guys >> adding them manually? For all the hundreds of expense types? I find it hard >> to believe this. >> >> Naively, I thought of just going thorugh all accounts from the importer >> and adding OPEN instruction for them but then, I have multiple importers >> each of them potentially creating postings accessing the same account so >> their open directives would be conflicting. Hacking around this seems too >> complex and I am sure there is a solution to it... >> >> So, please, how do you create the open directives? >> > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/37fcd7d0-3ae7-4070-b093-8b2572e538fan%40googlegroups.com.
