{# Math explainer fragment for the Unrealized P/L KPI tile. Receives `b: UnrealizedBreakdown`. Aggregated formulas only — no per-position rows. #}
Unrealized P/L — open positions
{% if b.long_lines %}
Long stock & options
Σ market value
${{ "{:,.2f}".format(b.long_market_total|float) }}
− Σ cost basis
−${{ "{:,.2f}".format(b.long_cost_total|float) }}
= Unrealized
{% 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)
Σ premium received
${{ "{:,.2f}".format(b.short_premium_total|float) }}
− Σ est. value to close
−${{ "{:,.2f}".format(b.short_liability_total|float) }}
= Unrealized
{% 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 — no quote available; carried at basis.
{% endif %}
⚠ This is informational only. Consult a tax professional before filing.