{# Recent activity — last 5 trades on sym + account scope. Click → ticker timeline anchored to the trade row. #} {% if recent_trades %}
Recent activity
{% for t in recent_trades %} {# Derive per-share price: cost_basis for buys, proceeds for sells. #} {% if t.action|lower == "buy" and t.cost_basis is not none and t.quantity %} {% set per_share = t.cost_basis / t.quantity %} {% elif t.action|lower == "sell" and t.proceeds is not none and t.quantity %} {% set per_share = t.proceeds / t.quantity %} {% else %} {% set per_share = none %} {% endif %} {{ t.date }} {{ t.action }} {{ fmt_quantity(t.quantity) }} sh {% if per_share is not none %}@ {{ fmt_currency(per_share) }}{% else %}—{% endif %} {{ t.account }} {% endfor %}
{% endif %}