{# Inputs: allocation: AllocationView from portfolio.allocation.build_allocation() #} {% set rank_palette = [ '#0A84FF', '#FFD60A', '#30D158', '#FF375F', '#5E5CE6', '#64D2FF', '#5AC8FA', '#BF5AF2', 'rgba(181,181,255,0.65)', 'rgba(255,255,255,0.40)' ] %} {% set rest_color = 'rgba(255,255,255,0.14)' %} {% if allocation.symbol_count == 0 %}
No priced open positions in scope.
{% else %}
{# Donut #}
{% set ns = namespace(offset=0) %} {% set circumference = 251.327 %} {% for s in allocation.slices %} {% set seg_len = circumference * (s.pct|float) / 100.0 %} {% if s.is_rest %} {% set color = rest_color %} {% else %} {% set color = rank_palette[s.rank - 1] %} {% endif %} {% set ns.offset = ns.offset + seg_len %} {% endfor %}
Total
${{ "%.1f"|format(allocation.total_market_value|float / 1000) }}k
{{ allocation.symbol_count }} symbol{% if allocation.symbol_count != 1 %}s{% endif %}
{# Concentration stats #}
Top holding {% set top = allocation.slices[0] %}{{ top.symbol }} ยท {{ "%.1f"|format(top.pct|float) }}%
Top 3 share {{ "%.1f"|format(allocation.top3_pct|float) }}%
Top 5 share {{ "%.1f"|format(allocation.top5_pct|float) }}%
Top 10 share {{ "%.1f"|format(allocation.top10_pct|float) }}%
{# Chip leaderboard #}
Top {{ allocation.slices|selectattr('is_rest','equalto',false)|list|length }} holdings
{% for s in allocation.slices %} {% if s.is_rest %} +{{ allocation.symbol_count - allocation.slices|rejectattr('is_rest')|list|length }} more ${{ "%.1f"|format(s.market_value|float / 1000) }}k {{ "%.1f"|format(s.pct|float) }}% {% else %} {% set color = rank_palette[s.rank - 1] %} {% set glow = s.rank <= 6 %} {{ s.symbol }} ${{ "%.1f"|format(s.market_value|float / 1000) }}k {{ "%.1f"|format(s.pct|float) }}% {% endif %} {% endfor %}
{% endif %}