{# Math explainer fragment for the TOTAL ACCOUNT VALUE hero KPI tile. Receives `b: AccountValueBreakdown`. Loaded via HTMX from /portfolio/explain/account-value and swapped into a div under the tile. #}
Total Account Value — current snapshot
{# Equation 1 — Composition: where the money sits today. #}
Composition
Cash balance
${{ "{:,.2f}".format(b.cash_balance|float) }}
+ Long stock & ETF market value
+${{ "{:,.2f}".format(b.long_stock_mv|float) }}
+ Long option market value
+${{ "{:,.2f}".format(b.long_option_mv|float) }}
− Short option est. liability
−${{ "{:,.2f}".format(b.short_option_liability|float) }}
= Total Account Value
{# Equation 2 — Source: how it got there, lifetime. #}
Source (lifetime)
Net contributed (deposits − withdrawals)
{% if b.net_contributed < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.net_contributed|float|abs) }}
+ Lifetime realized P/L (economic, after wash)
{% if b.lifetime_realized_economic < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.lifetime_realized_economic|float|abs) }}
+ Current unrealized P/L
{% if b.current_unrealized < 0 %}−{% else %}+{% endif %}${{ "{:,.2f}".format(b.current_unrealized|float|abs) }}
= Total Account Value
{# Footnote: economic vs tax-recognized clarification. #}
The Source equation uses economic realized — the cash that actually netted from closed positions. The Realized P/L KPI tile shows tax-recognized realized by default (with wash-sale-disallowed losses added back to basis), so it can differ from this row.
{# Caveats. #} {% if b.has_short_options %}
Short options estimated as intrinsic value + straight-line time decay; confirm cost-to-close with your broker.
{% endif %} {% if b.missing_symbols %}
⚠ {{ b.missing_symbols|length }} symbol{% if b.missing_symbols|length != 1 %}s{% endif %} carried at cost basis — no live quote ({{ b.missing_symbols[:8]|join(", ") }}{% if b.missing_symbols|length > 8 %}, +{{ b.missing_symbols|length - 8 }} more{% endif %}).
{% endif %} {# Footer: snapshot freshness + standard disclaimer. #} {% if b.fetched_at %}
as of {{ b.fetched_at.strftime("%b %-d") }} quotes
{% endif %}
⚠ This is informational only. Consult a tax professional before filing.