{% from "_provenance_macros.html" import provenance_link %} {% set partial = kpis.missing_symbols and (kpis.open_position_value is not none) %} {% set period_label = kpis.period_label or 'Period' %} {% set _profile = profile if profile is defined else None %} {% set _slots = _profile.order("portfolio_kpi_hero") if _profile else ["ytd_realized", "ytd_unrealized", "wash_impact", "open_position"] %} {% macro slot_ytd_realized(kpis, period_label, metric_refs) %}
Realized P/L
{% if kpis.period_realized < 0 %}−{% else %}+{% endif %}${{ "%.2f"|format(kpis.period_realized|float|abs) }}{% if metric_refs is defined and metric_refs.realized_period is defined %}{{ provenance_link(metric_refs.realized_period) }}{% endif %}
{{ period_label }}
{% endmacro %} {% macro slot_ytd_unrealized(kpis, period_label, metric_refs) %}
Unrealized P/L
{% if kpis.period_unrealized is none %} {% elif kpis.period_unrealized < 0 %}−${{ "%.2f"|format(kpis.period_unrealized|float|abs) }} {% else %}+${{ "%.2f"|format(kpis.period_unrealized|float) }} {% endif %}
{{ period_label }}
{% endmacro %} {% macro slot_lifetime_growth(kpis) %}
Lifetime growth
{% if kpis.lifetime_realized < 0 %}−{% else %}+{% endif %}${{ "%.2f"|format(kpis.lifetime_realized|float|abs) }}
all time
{% endmacro %} {% macro slot_open_position(kpis) %}
Open position $
{% if kpis.open_position_value is none %} {% else %}${{ "%.2f"|format(kpis.open_position_value|float) }}{% endif %}
{% if kpis.missing_symbols %}{{ kpis.missing_symbols|length }} unpriced{% else %}all priced{% endif %}
{% endmacro %} {% macro slot_wash_impact(metric_refs) %}
Wash impact
{% if wash_impact_total is defined and wash_impact_total %} −${{ "%.2f"|format(wash_impact_total|float|abs) }} {% else %} $0.00 {% endif %}
{% if wash_violations is defined and wash_violations %}{{ wash_violations }} violation{% if wash_violations != 1 %}s{% endif %}{% else %}no violations{% endif %}
{% endmacro %} {% macro slot_cash(cash_kpis) %}
Cash
{% if cash_kpis is defined and cash_kpis %} {% if cash_kpis.cash_balance < 0 %}−${{ "%.2f"|format(cash_kpis.cash_balance|float|abs) }} {% else %}${{ "%.2f"|format(cash_kpis.cash_balance|float) }}{% endif %} {% else %}{% endif %}
{% if cash_kpis is defined and cash_kpis %}{{ "%.0f"|format((cash_kpis.cash_share_pct|float) * 100) }}% of account{% endif %}
{% endmacro %}
{% for slot in _slots %} {% if slot == "ytd_realized" %}{{ slot_ytd_realized(kpis, period_label, metric_refs if metric_refs is defined else {}) }} {% elif slot == "ytd_unrealized" %}{{ slot_ytd_unrealized(kpis, period_label, metric_refs if metric_refs is defined else {}) }} {% elif slot == "lifetime_growth" %}{{ slot_lifetime_growth(kpis) }} {% elif slot == "open_position" %}{{ slot_open_position(kpis) }} {% elif slot == "wash_impact" %}{{ slot_wash_impact(metric_refs if metric_refs is defined else {}) }} {% elif slot == "cash" %}{{ slot_cash(cash_kpis if cash_kpis is defined else None) }} {% endif %} {% endfor %}
{% if offset_budget is defined and offset_budget %} {% set budget = offset_budget %} {% include "_offset_budget_tile.html" with context %} {% endif %} {% include "_projection_card.html" with context %} {% if cash_kpis is defined %}
{# --- Cash --- #}
Cash
{% if cash_kpis.cash_balance < 0 %} −${{ "%.2f"|format(cash_kpis.cash_balance|float|abs) }} {% else %} ${{ "%.2f"|format(cash_kpis.cash_balance|float) }} {% endif %}{% if metric_refs is defined and metric_refs.cash is defined %}{{ provenance_link(metric_refs.cash) }}{% endif %}
{{ "%.0f"|format((cash_kpis.cash_share_pct|float) * 100) }}% of account
{# --- Net contributed --- #}
Net contributed
{% if cash_kpis.net_contributions < 0 %} −${{ "%.2f"|format(cash_kpis.net_contributions|float|abs) }} {% else %} ${{ "%.2f"|format(cash_kpis.net_contributions|float) }} {% endif %}{% if metric_refs is defined and metric_refs.net_contributed_period is defined %}{{ provenance_link(metric_refs.net_contributed_period) }}{% endif %}
deposits − withdrawals
{# --- Growth --- #}
Growth
{% if cash_kpis.growth < 0 %}−{% else %}+{% endif %}${{ "%.2f"|format(cash_kpis.growth|float|abs) }}
{% if cash_kpis.growth_pct is not none %} {% if cash_kpis.growth_pct < 0 %}−{% else %}+{% endif %}{{ "%.1f"|format((cash_kpis.growth_pct|float|abs) * 100) }}% vs contributed {% else %} no contributions {% endif %}
{% endif %} {% if snapshot is defined and snapshot.degraded %}
Showing stale prices (provider unavailable).
{% endif %} {% if kpis.missing_symbols %}
{% if kpis.open_position_value is none %} No quotes available. {% else %} Partial sum — {{ kpis.missing_symbols|length }} symbol{% if kpis.missing_symbols|length != 1 %}s{% endif %} unpriced: {{ kpis.missing_symbols|join(', ') }} {% endif %}
{% endif %}