Can I make a balance assertion about market value? (I think not)

74 views
Skip to first unread message

Aakash Mehendale

unread,
Jan 8, 2021, 9:24:27 AM1/8/21
to Beancount
Misposted this support query to the issue tracker https://github.com/beancount/beancount/issues/604 , so reposting here for posterity

I have an investment account (as background information, it's non-taxable so I use the NONE booking method) in which I buy units of a mutual fund. My broker provides an account summary which lists my current holding, latest market price, and current market value. I can enter a balance assertion to confirm that my file agrees with my broker in respect of the number of units of the fund.

I also put the latest price into my beancount file with a price directive. Can I use a balance assertion to confirm that my file agrees with my broker in respect of the current market value?


Example beancount file:


option "operating_currency" "GBP"
plugin "beancount.plugins.unrealized" "Unrealized"
plugin "beancount.plugins.implicit_prices"

* Commodities
2012-09-07 commodity GBP
  name: "Pound Sterling"

2012-09-07 commodity B41XG30
  name: "Vanguard LifeStrategy 100% Equity Accumulation (GBP)"
 
* Accounts
2012-09-07 open Assets:ISA
2012-09-07 open Assets:ISA:Cash GBP
2012-09-07 open Assets:ISA:B41XG30 B41XG30 "NONE"
2012-09-07 open Income:BankAccount:2783        GBP


* Transactions

;topup
2012-09-07 * "REG. SAVER // Transfer From Bank Account Bank A/C : ****2783"
  Assets:ISA:Cash 75 GBP
  Income:BankAccount:2783
 
;purchase
2012-09-10 *   "B346530501 // Vanguard LifeStrategy 100% Equity Accumulation (GBP) .7242 @  10356.66380"
  Assets:ISA:B41XG30 0.7242 B41XG30 { 103.56638 GBP }
  Assets:ISA:Cash -75.00 GBP
 
; final price point
2021-01-07 price B41XG30 260.188 GBP

; balance assertion about units held, works as desired
2021-01-07 balance Assets:ISA:B41XG30 0.7242 B41XG30

; balance assertion about market value - doesn't work, want to find out how to do this
2021-01-07 balance Assets:ISA 188.43 GBP


With the above file, both bean_web and fava know that the market value of Assets:ISA is 188.43 GBP - is there a way I can assert this fact within the beancount file itself?



Was advised on the linked issue that the answer is:

This is currently not supported.[...] Beancount balance assertions [...] assert that the specified account contains exactly the specified amount of a given commodity, without conversions.


Would be interested to learn if there are any options / workarounds


Ben Blount

unread,
Jan 8, 2021, 11:45:29 AM1/8/21
to Beancount
bean-query has functions to convert holdings to market value. You could use these to write a query and dump your holdings at market value.

If you're ok with writing some python it would be fairly straightforward to script that together into the type of balance assertions you're looking for.

Here's an example Altynbek recently posted on this group: https://www.isabekov.pro/multiperiod-hledger-style-reports-in-beancount-pivoting-a-table/

--
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/6fc06ff1-ca8f-4a8d-a3ae-a908c2deb2ebn%40googlegroups.com.

Martin Blais

unread,
Jan 8, 2021, 4:21:08 PM1/8/21
to Beancount
Exactly what I'd say.
There's no built-in way to do it, and I also don't see it as useful: if you've asserted the number of units and your price points are in the file correctly, I don't see how this helps very much.

In the VLT it would be super fun for balance assertions to be completely replaced by queries (with their full generality). But it's in the aspirational category at this moment





Reply all
Reply to author
Forward
0 new messages