I read your question a few times and I'm still not clear what you don't understand. That method will return the the sum of all the positions in the inventory which are in a particular currency (it doesn't do conversion): https://github.com/beancount/beancount/blob/master/beancount/core/inventory.py#L272
On Mon, Jan 10, 2022 at 1:45 PM Joshua Gilman <[email protected]> wrote: > Hi all, > > I'm still relatively new to all of the Beancount specific language and I'm > trying to wrap my head around how to understand an inventory and positions. > I'm writing a Python script in which I am attempting to build a list of > accounts and their respective balances. The initial bit looks like this: > > entries, errors, options = loader.load_file(os.path.join(root, main_file)) > accounts = realization.realize(entries) > for account in realization.iter_children(accounts, True): > # TODO > > From the above, I can access "account.balance" which is an instance of an > Inventory. This is where things get a little confusing for me. My Beancount > setup is very simple, only tracking transactions in a few dozen accounts > and all in one currency. This leads me to believe that I can use the > "get_currency_units" method in the Inventory class in order to get the > account balance in my default unit (USD) for each account. The problem I > ran into is that if the balance is 0.00 USD the aforementioned method > returns nothing as do all other Inventory methods that involve calculating > a value. The account has transactions in it, they just happen to equate to > 0.00. This makes me wonder if I understand what a position is and if I'm > even on the right path to calculate an account balance. Is it safe for me > to assume that if it returns nothing that the balance must then be 0.00? > But how do I know that it's 0.00 in USD? Any help or clarification is > appreciated! > > -- > 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/83726537-9577-4bbf-ad8c-bef7b62d771an%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/83726537-9577-4bbf-ad8c-bef7b62d771an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAK21%2BhM5sm6bMZdAXSTEVA6zUMeygM%2Bb4g%3DbR_XYgUarMT84kg%40mail.gmail.com.
