If I wish to mark a set of accounts as a group, such that they all
work together for calculating average cost, what syntax would you
recommend?
For example, say I buy some gold and store it at vault vendor "Solid"
and buy and store some more at vault vendor "Guard".
I would record my purchases like:
2026-01-20 * "Solid" "buy 1.5 oz"
Assets:Metals:Vaulted:Solid 1.5 AU {5000 USD}
Assets:Bank -7500.00 USD
2026-02-15 * "Guard" "buy 2oz"
Assets:Metals:Vaulted:Guard 2 AU {4300 USD}
Assets:Bank -8600.00 USD
When it comes time to sell, say I sell 3oz at average cost. I wish
to use the cost records in both Vaulted:Solid and Vaulted:Guard
to calculate a true average cost for gold.
How would I do that now? And if not now, how would beancount prefer
the syntax to be for such a grouping?
; mark accounts as a costing group
2026-01-01 open Assets:Metals:Vaulted AU "NONE" "GoldCost"
2026-01-01 open Assets:Metals:Vaulted:Guard AU "NONE" "GoldCost"
2026-01-01 open Assets:Metals:Vaulted:Solid AU "NONE" "GoldCost"
; use the group
2026-04-01 * "Guard" "sell 2 oz"
Assets:Bank 9750.00 USD
; auto calculated cost of 4600.00 USD:
Assets:Metals:Vaulted:Guard -2 AU @ 4875.00 USD
; auto calc PnL: -550.00 USD
Income:Metals:PnL
2026-04-01 * "Solid" "sell 1 oz"
Assets:Bank 4850.00 USD
; auto calculated cost of 4600.00 USD:
Assets:Metals:Vaulted:Solid -1 AU @ 4850.00 USD
; auto calc PnL: -250.00 USD
Income:Metals:PnL
Thanks,
- Chris
> --
> 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 visit
https://groups.google.com/d/msgid/beancount/acOThKs7QhI2G28l%40foursquare.net.