<%# locals: (investment_statement:, period:, **args) %> <% if investment_statement.investment_accounts.any? %>

<%= t(".title") %>

<%= format_money(investment_statement.portfolio_value_money) %>

<% trend = investment_statement.unrealized_gains_trend %> <% if trend %>
<%= t(".total_return") %>: <%= format_money(Money.new(trend.value, Current.family.currency)) %> (<%= trend.percent_formatted %>)
<% end %>
<% holdings = investment_statement.top_holdings(limit: 5) %> <% if holdings.any? %>
<%= t(".holding") %>
<%= t(".weight") %>
<%= t(".value") %>
<%= t(".return") %>
<% holdings.each_with_index do |holding, idx| %>
">
<% if holding.security.logo_url.present? %> <%= holding.ticker %> <% else %>
<%= holding.ticker[0..1] %>
<% end %>

<%= holding.ticker %>

<%= truncate(holding.name, length: 20) %>

<%= number_to_percentage(holding.weight || 0, precision: 1) %>
<%= format_money(holding.amount_money) %>
<% if holding.trend %> <%= holding.trend.percent_formatted %> <% else %> - <% end %>
<% end %>
<% end %> <%# Investment Activity Summary %> <% totals = investment_statement.totals(period: period) %> <% if totals.trades_count > 0 %>

<%= t(".period_activity", period: period.label) %>

<%= t(".contributions") %>: <%= format_money(totals.contributions) %>
<%= t(".withdrawals") %>: <%= format_money(totals.withdrawals) %>
<%= t(".trades") %>: <%= totals.trades_count %>
<% end %>
<% end %>