Files
gold_monitor/app/templates/records.html
T
2026-10-17 22:15:22 +08:00

58 lines
2.4 KiB
HTML

{% extends "base.html" %}
{% block title %}交易复盘 · {{ app_name }}{% endblock %}
{% block content %}
<h2 style="margin:0 0 6px">交易记录与复盘</h2>
<p class="muted" style="margin:0 0 14px">列表可按机器筛选 → 点开详情 → 四周期 K 线 + 入场形式标注。</p>
<div class="card" style="margin-bottom:14px">
<form method="get" action="{{ url_for('records_page') }}" style="display:flex;gap:10px;align-items:center;flex-wrap:wrap">
<label class="muted" for="machine_id">机器</label>
<select name="machine_id" id="machine_id" style="min-width:200px">
<option value="">全部机器</option>
{% for m in machines %}
<option value="{{ m.id }}" {% if selected_machine_id == m.id %}selected{% endif %}>
{{ m.name }} #{{ m.id }}{% if m.online %} · 在线{% endif %}
</option>
{% endfor %}
</select>
<button type="submit" class="btn">筛选</button>
{% if selected_machine_id %}
<a class="btn secondary" href="{{ url_for('records_page') }}">清除</a>
{% endif %}
<span class="muted">共 {{ trades|length }} 条</span>
</form>
</div>
<div class="card">
<table>
<thead>
<tr>
<th>ID</th><th>品种</th><th>方向</th><th>手数</th><th>开仓价</th><th>平仓价</th>
<th>盈亏</th><th>账户</th><th>机器</th><th>入场形式</th><th></th>
</tr>
</thead>
<tbody>
{% for t in trades %}
<tr>
<td>{{ t.id }}</td>
<td>{{ t.symbol }}</td>
<td><span class="tag {% if t.side=='buy' %}green{% else %}red{% endif %}">{{ t.side }}</span></td>
<td>{{ t.volume }}</td>
<td>{{ t.open_price }}</td>
<td>{{ t.close_price if t.close_price is not none else '—' }}</td>
<td style="color:{% if t.profit and t.profit>0 %}var(--green){% elif t.profit and t.profit<0 %}var(--red){% else %}inherit{% endif %}">
{{ t.profit if t.profit is not none else '—' }}
</td>
<td>{{ t.account_name or '—' }}</td>
<td>{{ t.machine_name or '—' }}</td>
<td>{{ t.entry_style or '—' }}</td>
<td><a href="{{ url_for('record_detail', tid=t.id) }}">打开复盘</a></td>
</tr>
{% else %}
<tr><td colspan="11" class="muted">暂无数据。{% if selected_machine_id %}当前机器下没有成交。{% else %}客户端上报成交后出现在此。{% endif %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}