{% extends "_layout.html" %} {% set active_page = 'holdings' %} {% import 'macros/_account_macros.html' as account_macros with context %} {% macro num_cell(value, currency) -%} {{ value|format_currency(currency) }} {%- endmacro %} {% block content %}

{% if aggregation_key %}{{ _('Holdings') }}{% else %}{{ _('Holdings') }}{% endif %}

{% for key, label in [('account', _('Account')), ('currency', _('Currency')), ('cost_currency', _('Cost currency'))] %}

{% if not (aggregation_key == key) %}{{ _('Holdings by') }} {{ label }}{% else %}{{ _('Holdings by') }} {{ label }}{% endif %}

{% endfor %}
{% set holdings = api.holdings(aggregation_key) %} {% for posting in holdings %} {% set cost_currency = posting.cost.currency if posting.cost else posting.units.currency %} {{ num_cell(posting.units.number if posting.units.currency != '*' else None, posting.units.currency) }} {{ num_cell(posting.cost.number, cost_currency) }} {{ num_cell(posting.price, cost_currency) }} {{ num_cell(posting.units.number * posting.cost.number if posting.cost else posting.units.number, cost_currency) }} {{ num_cell(posting.units.number * posting.price if posting.price else None, cost_currency) }} {% endfor %}
{{ _('Account') }} {{ _('Units') }} {{ _('Currency') }} {{ _('Cost currency') }} {{ _('Average Cost') }} {{ _('Price') }} {{ _('Book Value') }} {{ _('Market Value') }} {{ _('Acquisition Date') }}
{{ account_macros.account_name(posting.account) }}{{ posting.units.currency}} {{ cost_currency }}{{ posting.cost.date or '' if posting.cost else '' }}
{% endblock %}