已平仓记录增加平仓盈亏列,展示价差毛利
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -197,7 +197,7 @@
|
||||
<div class="section-title" style="font-size:0.88rem;margin-bottom:0;padding:6px 12px;">{{ pc }} · {{ trades|length }} 笔</div>
|
||||
{% endif %}
|
||||
<table>
|
||||
<tr><th>合约</th><th>方向</th><th>开仓</th><th>平仓</th><th>持仓</th><th>开仓价</th><th>平仓价</th><th>开仓费</th><th>平仓费</th><th>盈亏</th><th>操作</th></tr>
|
||||
<tr><th>合约</th><th>方向</th><th>开仓</th><th>平仓</th><th>持仓</th><th>开仓价</th><th>平仓价</th><th>开仓费</th><th>平仓费</th><th>平仓盈亏</th><th>盈亏</th><th>操作</th></tr>
|
||||
{% for t in trades %}
|
||||
<tr>
|
||||
<td><strong>{{ t.contract_code.replace(t.product_code, '', 1) }}</strong></td>
|
||||
@@ -215,6 +215,16 @@
|
||||
<td>{{ t.close_price }}</td>
|
||||
<td>{{ t.open_fee or 0 }}</td>
|
||||
<td>{{ t.close_fee or 0 }}</td>
|
||||
<td>
|
||||
{% if t.direction == 'short' %}
|
||||
{% set gross_pnl = (t.open_price - t.close_price) * t.point_value %}
|
||||
{% else %}
|
||||
{% set gross_pnl = (t.close_price - t.open_price) * t.point_value %}
|
||||
{% endif %}
|
||||
<span style="font-weight:700;{% if gross_pnl > 0 %}color:var(--danger-fg);{% elif gross_pnl < 0 %}color:var(--success-fg);{% else %}color:var(--sub);{% endif %}">
|
||||
{% if gross_pnl > 0 %}+{% endif %}{{ '%.2f'|format(gross_pnl) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{% set p = t.pnl %}
|
||||
{% if p is not none %}
|
||||
|
||||
Reference in New Issue
Block a user