{# 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" }}
{% if pagination is defined and pagination.total_pages > 1 %}
Showing {{ ((pagination.page - 1) * pagination.page_size) + 1 }}–{{ [pagination.page * pagination.page_size, pagination.total_rows]|min }} of {{ pagination.total_rows }}
{% if pagination.page > 1 %} ← Prev {% else %} ← Prev {% endif %} Page {{ pagination.page }} / {{ pagination.total_pages }} {% if pagination.page < pagination.total_pages %} Next → {% else %} Next → {% endif %}
{% endif %}