How to create opening balance for commodity holdings ans positions?

335 views
Skip to first unread message

litt.f...@gmail.com

unread,
May 1, 2021, 5:32:19 AM5/1/21
to Beancount
Hey,

I'm in a case where I create a new ledger file for every financial year. This works great because the file is clear and clean and, you know what you are working with.

For the normal financial accounts creating opening balances is fine, but I'm wondering how can I create "opening positions" for commodities I bought/sold in the previous year?

Obviously I can just create an opening balance for the commodity itself, but it's not clear if there is a way to specify which of that balance was bought at which prices. This puts me in the position where in the next year, I sell a foreign currency, but I'm unable to get an accurate PnL because it doesn't have the positions at which it was purchased in the first place.

Is there a way to specify opening positions somehow?

James Cook

unread,
May 1, 2021, 1:19:31 PM5/1/21
to bean...@googlegroups.com
I think this should do what you want. Someone please let me know if
this is a bad idea.

2020-01-01 * "Opening balances"
Assets:Brokerage:ACME 10 ACME {10.00 USD, 2015-01-01}
Assets:Brokerage:ACME 10 ACME {15.00 USD, 2015-02-01}
Assets:Brokerage:ACME 10 ACME {14.00 USD, 2015-03-01}
Equity:Balances

--
James

redst...@gmail.com

unread,
May 1, 2021, 3:02:56 PM5/1/21
to Beancount
That would be exactly how I'd write it if I wanted to.

However, for the OP: I'd think deep and hard about whether the benefits you get ("clear and clean") outweigh the downsides of annual ledger files. The amount of additional work required, both initial work each year, and maintenance is non-trivial. Changes need to be propagated across years, manually. Queries execution across years can be tricky. Etc. Alternatives:
- using beancount to dump the balances at the start of each year into a file, as comments (best of both worlds?)
- real-world-account based structure (offers a different form of clear/clean, with complete automation)

Ben Blount

unread,
May 1, 2021, 3:37:33 PM5/1/21
to Beancount
+1 to Red.

I also just want to make sure you're aware that beancount tools generally have date filtering built in. Bean-query has "FROM OPEN ON" and Fava has the date filter bar.

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/7a72f0f4-c65d-4792-a438-cc832053a205n%40googlegroups.com.

litt.f...@gmail.com

unread,
May 1, 2021, 7:44:10 PM5/1/21
to Beancount
ok thanks for the comments. I decided to follow your advice and just use a single set of books.

redst...@gmail.com

unread,
May 1, 2021, 9:08:46 PM5/1/21
to Beancount
Cool. To add to what Ben said, Fava has support for financial years.
Reply all
Reply to author
Forward
0 new messages