{# The portfolio's return over every period at once — a day, a week, a month, three, the year so far, a year, three years, since the first trade. Each tile: the time-weighted return and the gain in money, both with the flows of the period taken out, so a deposit is not a gain and a withdrawal not a loss. Needs `perf` (performance.periods) and `s.base_currency`. #} {% set labels = {"1d": _("1 day"), "1w": _("1 week"), "1m": _("1 month"), "3m": _("3 months"), "ytd": _("YTD"), "1y": _("1 year"), "3y": _("3 years"), "all": _("Since start")} %}
{% for key in ("1d", "1w", "1m", "3m", "ytd", "1y", "3y", "all") if key in perf %} {% set p = perf[key] %}
{{ labels[key] }}
{% if p.twr is not none %}
{{ '%+.2f' | format(100 * p.twr) }} %
{% if p.pnl is not none %}{{ '+' if p.pnl >= 0 else '−' }}{{ big(p.pnl | abs, s.base_currency) }}{% else %}—{% endif %}
{% if key in ("all", "3y", "1y") and p.twr_annual is not none and p.days > 366 %}
{{ _f("{pct} % a year", pct='%+.1f' | format(100 * p.twr_annual)) }}
{% elif key not in ("1d", "1w", "1m", "3m") and p.since %}
{{ _f("since {date}", date=d(p.since)) }}
{% endif %} {% else %}
 
{% endif %}
{% endfor %}