博弈分析按合约分类展示,新增合约下拉选择器

This commit is contained in:
2026-07-24 22:58:44 +08:00
parent de62f0779b
commit 492ca9d82e
5 changed files with 66 additions and 29 deletions
+18 -7
View File
@@ -4,6 +4,17 @@
{% block breadcrumb %}机构持仓{% endblock %}
{% block content %}
{% if contracts %}
<div style="display:flex;align-items:center;gap:12px;margin-bottom:20px;">
<span style="font-size:0.85rem;color:var(--sub);">合约</span>
<select onchange="window.location='?contract='+this.value" style="padding:6px 12px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--fg);font-size:0.88rem;">
{% for c in contracts %}
<option value="{{ c }}"{% if c == selected %} selected{% endif %}>{{ c }}</option>
{% endfor %}
</select>
</div>
{% endif %}
{% if latest_date %}
<div class="stat-grid">
<div class="stat-card">
@@ -11,7 +22,7 @@
<div class="value">{{ latest_date }}</div>
</div>
<div class="stat-card">
<div class="label">参考现价</div>
<div class="label">{{ selected }} 现价</div>
<div class="value">{{ current_price }}</div>
</div>
<div class="stat-card">
@@ -27,6 +38,7 @@
<div class="section-title">机构持仓明细</div>
<div class="table-wrap">
<table>
<tr>
<th>机构</th><th>多单</th><th>空单</th><th>净持仓</th><th>净盈亏</th>
</tr>
{% for r in rows %}
@@ -48,17 +60,16 @@
{% endfor %}
<tr style="font-weight:700; background:var(--th-bg);">
<td>合计</td>
<td>{{ totals.long_pos }}</td>
<td>{{ totals.short_pos }}</td>
<td>{{ totals.net_pos }}</td>
<td>{{ totals.pnl }}</td>
<td></td>
<td></td>
<td>{{ total_net_short }}</td>
<td>{{ total_pnl }}</td>
</tr>
</table>
</div>
{% else %}
<div style="text-align:center;padding:60px 0;color:var(--sub);">
<p style="font-size:1.1rem;">暂无持仓数据</p>
<p style="margin-top:8px;"><a href="/input/" style="color:var(--accent);">前往录入 →</a></p>
<p style="font-size:1.1rem;">暂无「{{ selected }}」的持仓数据</p>
</div>
{% endif %}
{% endblock %}