I can't figure out how to write a query that prints the aggregate balance 
of an account subtree as of a given date, converted to USD using the price 
as of that date. Example data:

$ cat >test.bean <<EOF
plugin "beancount.plugins.auto_accounts"
2020-01-01 * "Open"
  Assets:Bank:AAA 100 AAA
  Assets:Bank:BBB 100 BBB
  Income:Work
2021-01-01 price AAA 1 USD
2021-01-01 price BBB 10 USD
2021-01-02 price AAA 2 USD
2021-01-02 price BBB 20 USD
2021-01-03 price AAA 3 USD
2021-01-03 price BBB 30 USD
EOF
$ bean-query test.bean 'SELECT convert(units(sum(position)), "USD") AS 
value WHERE account ~ "Assets:Bank"'
 value
--------
3300 USD

I'd like to be able to specify a date and get the balance at the end of 
that date, e.g. 2021-01-02 => 2200 USD. I tried using "FROM DATE = 
2021-01-02" or "FROM DATE <= 2021-01-02" but it doesn't affect the result.

Thank you in advance,
Mark

-- 
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/a1cfbd22-e495-40e8-b6ea-055fd9227d47n%40googlegroups.com.

Reply via email to