双买持仓表新增盈亏平衡点列;交易记录无平仓品种时隐藏统计面板

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-07-29 10:54:26 +08:00
parent 9c04ad642e
commit 934d83829a
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -87,7 +87,7 @@
{% if open_trades %}
<div class="table-wrap">
<table>
<tr><th>品种</th><th>合约</th><th>C行权价</th><th>P行权价</th><th>开仓日期</th><th>看涨开仓价</th><th>看跌开仓价</th><th>C手续费</th><th>P手续费</th><th>总成本</th><th>操作</th></tr>
<tr><th>品种</th><th>合约</th><th>C行权价</th><th>P行权价</th><th>开仓日期</th><th>看涨开仓价</th><th>看跌开仓价</th><th>C手续费</th><th>P手续费</th><th>总成本</th><th>平衡(上)</th><th>平衡(下)</th><th>操作</th></tr>
{% for t in open_trades %}
<tr>
<td>{{ t.product_code }}</td>
@@ -100,6 +100,8 @@
<td>{{ t.call_open_fee or 0 }}</td>
<td>{{ t.put_open_fee or 0 }}</td>
<td><b>{{ "%.0f"|format(t.total_cost) }}</b></td>
<td style="color:var(--danger-fg);font-weight:600;">{{ "%.1f"|format(t.breakeven_upper) }}</td>
<td style="color:var(--success-fg);font-weight:600;">{{ "%.1f"|format(t.breakeven_lower) }}</td>
<td>
<button style="background:var(--warn);color:#fff;border:none;padding:3px 10px;border-radius:4px;cursor:pointer;font-size:0.78rem;"
onclick="showOpenAnalysis('{{ t.product_code }} {{ t.contract_code.replace(t.product_code, '', 1) }}', {{ t.call_strike_price }}, {{ t.put_strike_price }}, {{ t.call_open_price }}, {{ t.put_open_price }}, {{ t.call_open_fee or 0 }}, {{ t.put_open_fee or 0 }}, {{ t.point_value }})">分析</button>
+2
View File
@@ -295,6 +295,7 @@
{% set ns.close_fee = ns.close_fee + (t.close_fee or 0) %}
{% endfor %}
{% set net = ns.gross - ns.open_fee - ns.close_fee %}
{% if summary_trades %}
<div style="display:flex;gap:24px;margin-bottom:24px;padding:12px 18px;background:var(--surface);border:1px solid var(--border);border-radius:8px;font-size:0.88rem;flex-wrap:wrap;">
<span>平仓盈亏 <b style="{% if ns.gross > 0 %}color:var(--danger-fg);{% elif ns.gross < 0 %}color:var(--success-fg);{% endif %}">{% if ns.gross > 0 %}+{% endif %}{{ '%.2f'|format(ns.gross) }}</b></span>
<span style="color:var(--sub);">|</span>
@@ -306,6 +307,7 @@
<span style="color:var(--sub);">|</span>
<span>收益 <b style="{% if net > 0 %}color:var(--danger-fg);{% elif net < 0 %}color:var(--success-fg);{% endif %}">{% if net > 0 %}+{% endif %}{{ '%.2f'|format(net) }}</b></span>
</div>
{% endif %}
{% else %}
<div style="text-align:center;padding:60px;color:var(--sub);">暂无已平仓记录</div>
{% endif %}