OK after reading the Inventory
<https://github.com/beancount/beancount/blob/v2/beancount/core/inventory.py>
class docs, I think I've got words for my issue -- the query's balance is a
single inventory for all accounts, and I'd like an inventory per account.
I think if I just want a csv I can export to a stacked area chart in a
spreadsheet, I can do something like:
inventories = defaultdict(lambda: Inventory())
for directive in beancount.loader.load_file(...):
if isinstance(directive, Transaction) and asset_leg(directive) is not
None:
inventories[asset_leg(directive).account].add_position(asset_leg(directive).position)
print_line(inventories)
On Sun, Feb 14, 2021 at 2:00 PM Aaron Stacy <[email protected]> wrote:
> For example, this query is useful:
>
> SELECT date, flag, description, account, units(position),
> units(balance)
>
> But it loses the information for the balance of each account (i.e. are the
> shares of Vanguard 2050 target retirement fund in my 401k or IRA?), which
> would be nice for a stacked area chart to visualize both the sum across
> accounts over time as well as individual account balances.
>
> It seems like maybe calling beancount.loader.load_file, and then iterating
> over the transactions with an inventory object for each account may be the
> way to go.
>
> On Sun, Feb 14, 2021 at 9:46 AM Aaron Stacy <[email protected]>
> wrote:
>
>> Hi all, my I’ve seen some references to net worth over time
>> scripts/queries, but I’m having trouble finding specifics. Anyone have
>> quick links to share? Thanks!
>
>
--
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/CACjABkm%3DiFsZwwr-fUJVnCSxWfKG4QU18PTfWJskSJrPrApQgA%40mail.gmail.com.