{# Common HTMX query string for swapping pages/toggle. #} {% set qs %}period={{ selected_period }}&account={{ selected_account }}&group_options={{ group_options }}{% endset %}
Show:
{{ total_rows }} {% if show == 'all' %}total{% else %}open{% endif %} · account: {% if selected_account %}{{ selected_account }}{% else %}all{% endif %}
{% if total_pages > 1 %} {% set prev_disabled = (page <= 1) %} {% set next_disabled = (page >= total_pages) %}
page {{ page }} / {{ total_pages }}
{% endif %}
{% if not rows %}
{% if show == 'all' %}No positions in scope.{% else %}No open positions.{% endif %}
{% else %} {% for r in rows %} {% endfor %}
Symbol Accounts Qty Mkt $ Open Cost Avg Basis Cash Sunk/sh {{ period_label }} Realized Unrealized
{{ r.symbol }} {% if r.qty == 0 %}closed{% endif %} {% if r.accounts|length <= 3 %} {{ r.accounts|join(' · ') }} {% else %} {{ r.accounts[0] }} +{{ r.accounts|length - 1 }} more {% endif %} {{ "%.4f"|format(r.qty|float) }} {% if r.market_value is none %} {% else %}${{ "%.2f"|format(r.market_value|float) }}{% endif %} ${{ "%.2f"|format(r.open_cost|float) }} ${{ "%.2f"|format(r.avg_basis|float) }} ${{ "%.2f"|format(r.cash_sunk_per_share|float) }} {% if r.realized_pl != 0 %}{% if r.realized_pl < 0 %}-{% else %}+{% endif %}${{ "%.2f"|format(r.realized_pl|float|abs) }}{% else %}—{% endif %} {% if r.unrealized_pl is none %} {% else %}{% if r.unrealized_pl < 0 %}-{% else %}+{% endif %}${{ "%.2f"|format(r.unrealized_pl|float|abs) }}{% endif %}
{% endif %}