{# Closed positions — historical realized lots from the Realized G/L import. Reads `closed_rows` (list of ClosedLotRow) and `closed_total_realized` from context, populated by routes/positions.py when `selected_view == 'closed'`. #}
{{ closed_rows_total|default(closed_rows|length) }} closed lot{% if (closed_rows_total|default(closed_rows|length)) != 1 %}s{% endif %} {% if closed_rows %} · {% if closed_total_realized < 0 %} {{ fmt_currency(closed_total_realized) }} {% else %} +{{ fmt_currency(closed_total_realized) }} {% endif %} realized {% endif %}
{% if not closed_rows %} {% else %} {% for row in closed_rows %} {% endfor %} {% endif %}
Symbol Acct Qty Basis Proceeds Realized Opened Closed Holding
No closed positions for this period. {% if selected_period == "ytd" %} Try switching to Lifetime, or import a Realized G/L CSV via Settings ⚙ → Imports. {% else %} Import a Realized G/L CSV via Settings ⚙ → Imports to populate this view. {% endif %}
{{ row.display_symbol }} {{ row.account }} {{ fmt_quantity(row.qty) }} {{ fmt_currency(row.cost_basis) }} {{ fmt_currency(row.proceeds) }} {% if row.realized_pl > 0 %}+{% endif %}{{ fmt_currency(row.realized_pl) }} {% if row.wash_sale %} W {% endif %} {{ fmt_date(row.opened_date) }} {{ fmt_date(row.closed_date) }} {{ "LT" if row.term == "Long Term" else "ST" }}
{% set _qs = '&view=closed' %} {% if selected_period %}{% set _qs = _qs + '&period=' + selected_period %}{% endif %} {% if selected_account %}{% set _qs = _qs + '&account=' + selected_account %}{% endif %} {% set page_base_url = '/positions' %} {% set page_extra_qs = _qs %} {% set page_target = '#positions-tab-content' %} {% set page_swap = 'outerHTML' %} {% include "_pagination_footer.html" %}