Adding transactions to beancount ledger

51 views
Skip to first unread message

Michael Droogleever

unread,
Mar 11, 2018, 12:28:05 PM3/11/18
to Beancount
I believe it is against the design of beancount, but is there any existing code which attempts to add transactions to an existing beancount file. Assuming the entries in the file are grouped by asset account, it would need to append the entry to the subsection of entries all from the same account.

Martin Blais

unread,
Mar 11, 2018, 1:00:47 PM3/11/18
to Beancount
There's nothing like that in the Beancount codebase. I've thought about building something to automatically insert imported transactions in the right "section" (I personally use org-mode, where each section corresponds to an institution and its related group of accounts) but it's unclear whether that would generalize.

I think you could turn this into a simple classification problem. Given some syntax for splitting up an input file into sections (e.g., some regular expression matching on a title or separator), you now have groups of transactions and inputs. Somehow reduce this to a simple model for classifying which section an incoming transaction matches with highest probability and insert it there. Or more appropriately - since transactions are imported in groups - find the section that best matches all the transactions in the imported files and insert at the end there.




On Sun, Mar 11, 2018 at 12:28 PM, Michael Droogleever <droo...@gmail.com> wrote:
I believe it is against the design of beancount, but is there any existing code which attempts to add transactions to an existing beancount file. Assuming the entries in the file are grouped by asset account, it would need to append the entry to the subsection of entries all from the same account.

--
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 beancount+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/7e031f82-3826-49ed-9494-15582eb718af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jakob Schnitzer

unread,
Mar 12, 2018, 8:02:40 AM3/12/18
to bean...@googlegroups.com
Fava has an UI to add transactions and code to insert them into the file
(which is also used when using Beancount's import system in Fava). The
code for it `insert_entry()` lives in

https://github.com/beancount/fava/blob/master/fava/core/file.py

It works with "custom" directives where one can give a regular
expression for the accounts to be inserted in a certain place.

Justus Pendleton

unread,
Mar 12, 2018, 11:08:37 PM3/12/18
to Beancount
On Sunday, March 11, 2018 at 11:28:05 PM UTC+7, Michael Droogleever wrote:
I believe it is against the design of beancount, but is there any existing code which attempts to add transactions to an existing beancount file. Assuming the entries in the file are grouped by asset account, it would need to append the entry to the subsection of entries all from the same account.

I think this would be something that would fit into a (rewritten, more advanced) bean-format. That way you add transactions wherever (e.g. just using shell redirection) but can then reformat it to be ordered into sections. I'm not really sure how the usage of includes fits into this. I break up my accounts into several files -- e.g. all US accounts are in us.bean, all Australian accounts are in au.bean, and so on. And I'm sure other people have other ways of splitting things up!
Reply all
Reply to author
Forward
0 new messages