<div id="replay-at">
  <h3 style="margin-bottom:4px">book on {{ at.date }}</h3>
  {% if at.nav %}
  <p>
    equity <b class="{{ 'pos' if at.nav.equity >= 0 else 'neg' }}">${{ at.nav.equity|money }}</b>
    <span class="muted">· realized</span>
    <span class="{{ 'pos' if at.nav.realized >= 0 else 'neg' }}">{{ at.nav.realized|money_signed }}</span>
    <span class="muted">· unrealized</span>
    <span class="{{ 'pos' if at.nav.unrealized >= 0 else 'neg' }}">{{ at.nav.unrealized|money_signed }}</span>
  </p>
  {% endif %}

  <h4 style="margin-bottom:4px">positions <span class="muted" style="font-size:12px">({{ at.positions|length }})</span></h4>
  <div class="table-wrap" style="max-height:380px; overflow-y:auto"><table class="fleet">
    <thead><tr><th>sleeve</th><th>symbol</th><th>qty</th><th>entry</th></tr></thead>
    <tbody>
    {% for p in at.positions %}
      <tr>
        <td data-label="sleeve" class="muted">{{ p.sleeve }}</td>
        <td data-label="symbol">{{ p.symbol }}</td>
        <td data-label="qty">{{ p.qty|qty }}</td>
        <td data-label="entry">{{ p.entry_price|qty }}</td>
      </tr>
    {% else %}
      <tr><td colspan="4" class="muted">no open positions on this date</td></tr>
    {% endfor %}
    </tbody>
  </table></div>

  <h4 style="margin-bottom:4px">trades on {{ at.date }} <span class="muted" style="font-size:12px">({{ at.trades|length }})</span></h4>
  <div class="table-wrap" style="max-height:380px; overflow-y:auto"><table class="fleet">
    <thead><tr><th>ts</th><th>sleeve</th><th>symbol</th><th>side</th><th>qty</th><th>price</th><th>reason</th></tr></thead>
    <tbody>
    {% for t in at.trades %}
      <tr>
        <td data-label="ts" class="muted" style="font-size:12px">{{ t.ts }}</td>
        <td data-label="sleeve" class="muted">{{ t.sleeve }}</td>
        <td data-label="symbol">{{ t.symbol }}</td>
        <td data-label="side" class="{{ 'pos' if t.side == 'BUY' else 'neg' }}">{{ t.side }}</td>
        <td data-label="qty">{{ t.qty|qty }}</td>
        <td data-label="price">{{ t.price|qty }}</td>
        <td data-label="reason" class="muted">{{ t.reason }}</td>
      </tr>
    {% else %}
      <tr><td colspan="7" class="muted">no trades on this date</td></tr>
    {% endfor %}
    </tbody>
  </table></div>
</div>
