Yes and you can call this from a Python script to avoid the parsing and get the right output types, see beanquery.query.run_query(). Search in the mailing-list, I believe this has come up a number of times.
Ultimately an even better way would be to support our custom types with some utilities for petl. No language, just a generic ETL tool, but with a small library that supports aggregations on positions, inventory, etc. On Sat, Oct 22, 2022 at 1:49 PM Máté Farkas <[email protected]> wrote: > With a small post-process step I can solve it with this BQL: > > -------------------------------- > SELECT > year, month, last(balance) as balance, last(getprice("CHF", "USD", > date)) as price > WHERE > account ~ 'Assets' > GROUP BY year, month > ORDER BY year, month > -------------------------------- > > Then there will be columns for the actual balances in USD, CHF and the > actual price. > (It requires that at least one transaction for every month to have every > row filled.) > > Do you have any better idea? > > Thank you, > Máté. > On Thursday, October 20, 2022 at 9:37:37 AM UTC+2 Máté Farkas wrote: > >> How can I get my monthly balance converted to the operating currency? >> >> Suppose that my beancount file is: >> >> --------------------------------- >> option "operating_currency" "USD" >> 2020-01-01 open Assets:USD USD >> 2020-01-01 open Assets:CHF CHF >> 2020-01-01 open Income:Payment >> >> 2020-01-01 * >> Assets:CHF 100 CHF >> Income:Payment >> >> 2020-01-01 price CHF 1.0 USD >> 2020-02-01 price CHF 2.0 USD >> 2020-03-01 price CHF 3.0 USD >> 2020-04-01 price CHF 4.0 USD >> 2020-04-01 price CHF 5.0 USD >> >> 2020-05-01 * >> Assets:CHF -100 CHF @@ 500 USD >> Assets:USD >> --------------------------------- >> >> Is there any way to query the monthly balance in USD? What I expect is: >> >> -------------------- >> 2020-01-01 100.0 USD >> 2020-02-01 200.0 USD >> 2020-03-01 300.0 USD >> 2020-04-01 400.0 USD >> 2020-05-01 500.0 USD >> -------------------- >> >> What is exactly what I can see in balance sheet in Fava, but I need the >> textual data in any way. >> >> I can query the monthly balance in the original currency. I do not know >> how to query the price rate for a given month. >> >> Thank you, >> Máté. >> >> -- > 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/ac04b8a5-0b27-4e6a-b46c-143d6d66e87dn%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/ac04b8a5-0b27-4e6a-b46c-143d6d66e87dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAK21%2BhNM5Tia3Y0KGZBHzZqKzrs%3D7wGBMVuzKB8%3DBu%2Bcr6zKiw%40mail.gmail.com.
