Holdings query output in fava

35 views
Skip to first unread message

Red S

unread,
Mar 7, 2020, 5:48:11 AM3/7/20
to Beancount
When I go to the Holdings page in fava and click "Query", it drops me into the query page with what's presumably the query run for the Holdings page.

1) However, when I run that query, the output is different from what I get on the output page. I see one difference is, sold lots appear on the query page, while they don't on the Holdings page. Where and how is this filtering (and others that I'm missing) being done?

2) The on-screen display in both the Holdings page and query page, and also in bean-query, has the columns requested:
account     units     cost     price     book_value     market_value     acquisition_date

However, if I download.csv, or for that matter run this query in python, the inventory columns returned expand to one per type of commodity. For example, there are many "units (TICKER)" column, one per ticker. How can I:
- get a single Inventory column of units (vs. multiple units column of type Decimal, one per commodity)
- how can I get a corresponding .csv in fava?

Red S

unread,
Mar 8, 2020, 5:52:36 AM3/8/20
to Beancount
Found the filter in fava/templates/holdings.html

{{ querytable.querytable(contents, result_types, result_rows, filter_empty=units_column.get(aggregation_key, 1)) }}

aggregation_key is one of the "tabs" ("holdings by [all, account, currency, cost_currency")).

Red S

unread,
Mar 8, 2020, 5:55:11 AM3/8/20
to Beancount
If someone has pointers on how the syntax works in fava/templates/*.html files, I'd most appreciate it. I'd love to write a few fava plugins, and not having to reverse engineer the syntax would be awesome and much faster :). Thank you!

Red S

unread,
Mar 9, 2020, 3:01:16 AM3/9/20
to Beancount
Found the answer for (2) as well: query.run_query(numberify=True)
Reply all
Reply to author
Forward
0 new messages