{# Math explainer fragment for a single equity-curve point. Receives `b: EquityPointBreakdown`. Loaded via HTMX from /portfolio/explain/equity-point and swapped into #explain-equity-point. #}
{% if b.is_starting_snapshot %}
Starting snapshot — {{ b.on.isoformat() }}
Holdings
{{ b.starting_holdings_count }} ticker{{ 's' if b.starting_holdings_count != 1 else '' }}
Contributed to date
${{ "{:,.2f}".format(b.starting_contributed_to_date|float) }}
First point in the selected series — no prior point to compare against.
{% else %}
Δ Account value — {{ b.on.isoformat() }} vs {{ b.previous_on.isoformat() }}
+ Contributions (cash in/out)
{{ "{:+,.2f}".format(b.contributions|float) }}
+ Realized P/L (trades closed today)
{{ "{:+,.2f}".format(b.realized_pnl|float) }}
+ Δ Unrealized (MTM on open positions)
{{ "{:+,.2f}".format(b.delta_unrealized|float) }}
+ Dividends
{{ "{:+,.2f}".format(b.dividends|float) }}
= Δ Account value
{% if b.residual > 0.5 or b.residual < -0.5 %}
residual (unattributed)
{{ "{:+,.2f}".format(b.residual|float) }}
{% endif %}
{# Conditional blocks below the equation. #} {% if b.trades %}
Trades closed today:
{% for t in b.trades %} {% endfor %}
Ticker Side Qty Realized P/L
{{ t.ticker }} {{ t.side }} {{ t.quantity }} {{ "{:+,.2f}".format(t.realized_pnl|float) }}
{% endif %} {% if b.top_movers %}
Top mark-to-market movers:
{% for m in b.top_movers %} {% endfor %}
Ticker Shares Prev Close Δ
{{ m.ticker }} {{ m.shares }} ${{ "{:,.2f}".format(m.prev_close|float) }} ${{ "{:,.2f}".format(m.close|float) }} {{ "{:+,.2f}".format(m.contribution|float) }}
{% endif %} {% if b.cash_events %}
Cash flow:
{% endif %} {% if b.dividend_events %}
Dividends:
{% endif %} {% if b.wash_events %}
Wash-sale activity:
{% endif %} {% if not b.trades and not b.top_movers and not b.cash_events and not b.dividend_events and not b.wash_events %}
No trades, dividends, or cash flow on this date. Mark-to-market moves are within $1.
{% endif %} {% if b.unpriced_tickers %}
⚠ ΔUnrealized may be incomplete. {{ b.unpriced_tickers|length }} ticker{% if b.unpriced_tickers|length != 1 %}s{% endif %} ({{ b.unpriced_tickers[:8]|join(", ") }}{% if b.unpriced_tickers|length > 8 %}, +{{ b.unpriced_tickers|length - 8 }} more{% endif %}) had no historical close cached for one of the boundary dates. Run net-alpha refresh-historical-cache to repair the cache, then reopen this panel.
{% endif %}
ΔUnrealized aggregates per-ticker price moves on lots open on {{ b.previous_on.isoformat() }}.
{% endif %}
⚠ This is informational only. Consult a tax professional before filing.