gain_loss() %}
                                {% set gain_loss_pct = portfolio.calculate_gain_loss_percentage() %}
                                <span class="{% if gain_loss >= 0 %}text-success{% else %}text-danger{% endif %}">
                                    {{ "%.2f"|format(gain_loss) }} ({{ "%.2f"|format(gain_loss_pct) }}%)
                                </span>
                            </td>
                            <td>
                                <a href="{{ url_for('portfolio_detail