I figured this out via the 'help targets' command:

'VALUE(Position,date)': Convert a position to its cost currency at the 
market value of a particular date.

Using value(sum(position), 2021-01-01) in my query returns the expected 
result.

On Friday, January 21, 2022 at 5:45:53 PM UTC-8 David Handy wrote:

> Hello,
>
> I am just getting started with bean-query, attempting to generate annual 
> net worth reports.
>
> Here is my current query:
>
> SELECT getitem(open_meta(account), 'name') as name, value(sum(position)) 
> AS balance FROM CLOSE ON 2021-01-01 CLEAR WHERE getitem(open_meta(account), 
> 'report') = 'true' GROUP BY name ORDER BY name
>
> Though I am closing the accounts on 2021-01-01, the value function is 
> using the latest price in my beancount file, rather than the last price 
> from the year 2020.
>
> Would love to figure out where I'm going wrong, thanks!
>
> -David
>

-- 
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/79733d03-5918-4e91-b3e7-21d2bbc7da0cn%40googlegroups.com.

Reply via email to