I do this: - I run https://bitbucket.org/blais/beancount/src/default/beancount/projects/export.py This joins a bunch of different data (e.g. metadata from open directives, positions, and more, read the source) to a single table of output for each lot, writes out a CSV file. The result is a single table of all the positions in my account including all the information I need to do various aggregations and determinations later, e.g. estimate tax liability, market value, long vs short term, category, etc.
Then I us this script: https://bitbucket.org/blais/beancount/src/default/bin/upload-to-sheets This takes the CSV file and uploads it to replace a specific sheet in an existing Google Sheets document. The google sheets doc has multiple sheets that all feed from that one flattened list of position. One of those sheets is something very close to what you describe. The advantage of this doings this way is that I can easily just change my allocations by fiddling with the sheets doc and see results immediately, rather than writing code. It also gives me intra-day changes and hedge protection estimates. Enjoy, On Thu, May 2, 2019 at 3:40 PM Alen Šiljak <[email protected]> wrote: > Please note that I'm completely new to Beancount so I'd like some opinions > and pointers. > I would like to implement the Asset Allocation with Beancount, in order to > migrate the functionality I currently have in > https://github.com/MisterY/asset-allocation. > > What currently happens, briefly: > > - Asset Allocation is defined. I.e. Equities:Australian:Large 60%; > Fixed:Australian:Government 40%. I'll used this for a simplified example. > - Stock symbols are linked to asset classes. > - Stock/fund amounts are read from the book, combined with the current > prices to get the current market value; including multiple currencies; > - The resulting report displays: > > Equities:Australian:Large - allocation 60%, current 53.25%, allocated > value 6000, current value 5325, diff -675, diff -9.5% > Fixed:Australian:Government - allocation 40%, current 46.75%, allocated > value 4000, current value 4675, diff 675, diff 15% (approximate value) > > From what I've read, this should be quite possible to get from Beancount. > I would like to add the allocation percentages in the commodity > declarations as meta tags. > Ideally, this could be a plugin. It could even operate on the balance > sheet, rather than depending on individual transactions. > > So, since I currently have no idea how to complete this, any pointers are > helpful. I assume a good doc to go through would be Beancount Scripting and > Plugins. > I've seen the experimental portfolio.py script, as well the asset > allocator project. These are on my reference list, to be examined into more > details. > I understand conceptually what needs to be done but what I don't know at > the moment is where to put the plugin script and how to read the holdings > data under "Assets:Investments", for example. > > I noticed that a few people are doing this so I'm wondering if there are > more working examples out there. > > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/df7fd48b-c725-4b1d-9435-d56e6b8f0e33%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/df7fd48b-c725-4b1d-9435-d56e6b8f0e33%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhOioCTcOqy_zdT%3DCKf1u9mEKx%2Bjtha_1q8VT-k_C81SbQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
