I learned recently that bean-query has a value() function that returns
market value of a position (contrary to the Beancount - Query Language
<https://docs.google.com/document/d/1s0GOZMcrKKCLlP29MD7kHO4L88evrwWdIO0p4EwRBE0/edit#heading=h.glx9uq8ceis>
docs).

I'm trying to write a query that sums all the positions of all my
retirement accounts and converts it to one currency.  I have CAD, USD, and
commodities that convert to either of those two currencies.

My previous query was something like this:

select convert(convert(sum(position), 'CAD'), 'USD') where account ~
'Assets:(Awesome|Regexp)'

Which handled the case where I only had commodity -> CAD and commodity ->
USD prices.  Turns out that dropping the inner CAD conversion is no longer
necessary (when did that change?)

Either way, I assumed that convert used the cost basis and didn't worry at
all about market value.

If I write a query like this:

select value(position) where account ~ 'Assets:(Awesome|Regexp)'

I get what I assume is the market value of all of these inventories.  If I
wrap it in a convert(..., 'USD'), I end up with the same result as the
previous queries.  Is convert doing a market value conversion?

If I convert from CAD to USD by hand, the numbers are reasonably close
together, so I think that's what's happening.

Either way, this seems to have changed from previous times I've run the
queries, so any help would be 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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAFFHUgtCyRT-bB64e5W-PZgccwJtf8hnvf%2B8ufKnJVoSBhoyAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to