{% import "_query_table.html" as querytable with context %}
{% set module = request.args.get('module') %}
{% for key, label in [('aa_class', _('Asset Allocation Classes')),
('aa_account', _('Asset Allocation Accounts')),
('cashdrag', _('Cash Drag')),
('tlh', _('Tax Loss Harvestor')),
('summarizer', _('Summarizer')),
('minimizegains', _('Gains Minimizer'))
] %}
{% if not (module == key) %}{{ label }}{% else %} {{ label }}{% endif %}
{% endfor %}
{% if (module == None) %}
Welcome! Fava Investor provides reports, analyses, and tools for investments. It
implemented as a collection of modules. Use the tabs on the top to navigate to each
module.
{% endif %}
{% macro table_list_renderer(title, tables) -%}
{{ title }}
{% if tables|length == 0 %}
Module not configured. See example.beancount for how to configure this module.
{% endif %}
{% for table in tables %}
Potential wash sales: purchases within the past 30 days
Below is a list of purchases with the past 30 days. "earliest_sale" is the date on
which a loss of the ticker shown can be harvested without resulting in a wash sale.
{% set table_empty_msg = None %}
{% if harvests[2][0]|length == 0 %}
{% set table_empty_msg = 'No purchases of the candidates above found within the last 30 days!' %}
{% endif %}
{{ querytable.querytable(ledger, table_empty_msg, *harvests[2]) }}
What not to buy
Below is a list of recent sales with losses. Assuming these losses were harvested,
purchasing these within 30 days of the sale could result in the loss becoming a wash
sale.
{% set lossy_sales = extension.recently_sold_at_loss() %}
{% set table_empty_msg = None %}
{% if lossy_sales[1]|length == 0 %}
{% set table_empty_msg = 'No sales with losses found in the last 30 days!' %}
{% endif %}
{{ querytable.querytable(ledger, table_empty_msg, *lossy_sales) }}
None of the above is meant to be financial, legal, tax, or other advice.
{% endif %}
{% set table_hover_text = _('Hold Shift while clicking to expand all children.
Hold Ctrl or Cmd while clicking to expand one level.') %}
{# TODO:
- add a format_percentage() to fava's template_filters, and use that here
- display 0 decimal places for assets (needed for all of fava_investor)
- fix: asset bucket spacing is too wide
- get currency from libassetalloc instead of looping: {% for currency in ledger.options.operating_currency %}
- remove links from asset class name
#}
{% macro asset_tree(account_node) %}
{% for currency in ledger.options.operating_currency %}
{{ currency }}
{% endfor %}
{{ _('Percentage') }}
{% for account in ([account_node] if account_node.name else account_node.children) recursive %}
{{ account.name.split('_')[-1] }}
{% for currency in ledger.options.operating_currency %}
{{ account.balance|format_currency(currency) }}{{ account.balance_children|format_currency(currency) }}
{% endfor %}
{% set percentage_parent = '{:3.0f}% of {}'.format(account.percentage_parent, account.parent.name) if account.parent else '' %}
{{ '{:6.2f} %'.format(account.percentage) if account.percentage else '' }}{{ '{:6.2f} %'.format(account.percentage_children) if account.percentage_children else '' }}
{% if account.children %}
{{ loop(account.children|sort(attribute='name')) }}
{% endif %}