{# Math explainer fragment for the Unrealized P/L KPI tile. Receives `b: UnrealizedBreakdown`. #}
Unrealized P/L — open positions
{% if b.long_lines %}
Long stock & options
{% for line in b.long_lines %} {% endfor %}
{{ line.symbol }} {{ "{:,.2f}".format(line.qty|float) }} × ${{ "{:,.2f}".format(line.last_price|float) }} − basis ${{ "{:,.2f}".format(line.cost_basis|float) }} {% if line.unrealized < 0 %}−{% elif line.unrealized > 0 %}+{% endif %}${{ "{:,.2f}".format(line.unrealized|float|abs) }}
Subtotal {% if b.long_subtotal < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.long_subtotal|float|abs) }}
{% endif %} {% if b.short_option_lines %}
Short options (estimate — intrinsic + time decay)
{% for line in b.short_option_lines %}
{{ line.symbol_display }} ×{{ line.contracts }}{% if line.is_covered %} (covered){% endif %}
premium received: ${{ "{:,.2f}".format(line.premium_received|float) }}
spot ${{ "{:,.2f}".format(line.spot|float) }} → intrinsic ${{ "{:,.2f}".format(line.intrinsic_per_share|float) }}/sh
{{ line.days_remaining }} of {{ line.days_total }} days remaining
time value: ${{ "{:,.2f}".format(line.time_value_per_share|float) }}/sh
est. value to close: ${{ "{:,.2f}".format(line.est_value_to_close|float) }}
unrealized = ${{ "{:,.2f}".format(line.premium_received|float) }} − ${{ "{:,.2f}".format(line.est_value_to_close|float) }} = {% if line.unrealized < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(line.unrealized|float|abs) }}
{% endfor %}
Subtotal {% if b.short_subtotal < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.short_subtotal|float|abs) }}
{% endif %}
Total Unrealized P/L {% if b.total_unrealized < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.total_unrealized|float|abs) }}
{% if b.excluded_count > 0 %}
{{ b.excluded_count }} lot{% if b.excluded_count != 1 %}s{% endif %} excluded from the estimate (no quote available; carried at basis).
{% endif %}
⚠ This is informational only. Consult a tax professional before filing.