{% extends "base.html" %}
{% block title %}{{ d.display_name }}{% endblock %}
{% block body %}
<p><a href="/">&larr; cockpit</a></p>
<p>sleeve <b>{{ d.sleeve }}</b> · venue <b>{{ d.venue }}</b> · as of <b>{{ d.as_of or '—' }}</b>
   · <span class="badge {{ d.gate_status }}">{{ d.gate_status }}</span> <span class="muted">{{ d.gate_reason }}</span></p>
<p>{{ d.days }} forward days ·
   <span class="{{ 'pos' if d.total_return_pct >= 0 else 'neg' }}">{{ '%+.2f'|format(d.total_return_pct) }}%</span>
   · Sharpe {{ '%.2f'|format(d.sharpe) }} · maxDD {{ '%.1f'|format(100*d.maxdd) }}%</p>
<div>{{ curve|safe }}</div>

<h3>per-period returns &amp; rolling mean <span class="muted">(raw — no normalization)</span></h3>
{% for period in ["daily", "weekly", "monthly"] %}
<details {% if period == "weekly" %}open{% endif %}>
  <summary>{{ period }}</summary>
  <table><thead><tr><th>period</th><th>ret%</th><th>rolling mean%</th></tr></thead><tbody>
  {% for p in d.periods[period] %}
    <tr><td>{{ p.label }}</td>
      <td class="{{ 'pos' if p.ret >= 0 else 'neg' }}">{{ '%+.3f'|format(100*p.ret) }}</td>
      <td class="{{ 'pos' if p.rolling_mean >= 0 else 'neg' }}">{{ '%+.3f'|format(100*p.rolling_mean) }}</td></tr>
  {% else %}
    <tr><td colspan="3" class="muted">no data yet</td></tr>
  {% endfor %}
  </tbody></table>
</details>
{% endfor %}

<h3>daily forward rows</h3>
<table><thead><tr><th>date</th><th>ret%</th><th>nav</th></tr></thead><tbody>
{% for p in d.history %}
  <tr><td>{{ p.date }}</td>
    <td class="{{ 'pos' if p.ret >= 0 else 'neg' }}">{{ '%+.3f'|format(100*p.ret) }}</td>
    <td>{{ '%.4f'|format(p.nav) }}</td></tr>
{% endfor %}
</tbody></table>
{% endblock %}
