From 621ee8c32d603d96caec335f7022d541d7944c4b Mon Sep 17 00:00:00 2001 From: fish Date: Tue, 28 Jul 2026 09:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=B9=B3=E4=BB=93=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=94=B9=E4=B8=BA=E5=B9=B3=E4=BB=93=E7=9B=88?= =?UTF-8?q?=E4=BA=8F=E3=80=81=E5=BC=80=E5=B9=B3=E6=89=8B=E7=BB=AD=E8=B4=B9?= =?UTF-8?q?=E3=80=81=E6=94=B6=E7=9B=8A=E5=9B=9B=E4=B8=AA=E6=8C=87=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- ft-app/app/templates/trades.html | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ft-app/app/templates/trades.html b/ft-app/app/templates/trades.html index 417c6f7..e76bff4 100644 --- a/ft-app/app/templates/trades.html +++ b/ft-app/app/templates/trades.html @@ -241,20 +241,25 @@ {% endfor %} {% set summary_trades = closed_trades if closed_tab == '全部' else grouped_closed.get(closed_tab, []) %} -{% set ns = namespace(total_pnl=0, total_open_fee=0, total_close_fee=0) %} +{% set ns = namespace(gross=0, open_fee=0, close_fee=0) %} {% for t in summary_trades %} - {% set ns.total_pnl = ns.total_pnl + (t.pnl or 0) %} - {% set ns.total_open_fee = ns.total_open_fee + (t.open_fee or 0) %} - {% set ns.total_close_fee = ns.total_close_fee + (t.close_fee or 0) %} + {% if t.direction == 'short' %} + {% set ns.gross = ns.gross + (t.open_price - t.close_price) * t.point_value %} + {% else %} + {% set ns.gross = ns.gross + (t.close_price - t.open_price) * t.point_value %} + {% endif %} + {% set ns.open_fee = ns.open_fee + (t.open_fee or 0) %} + {% set ns.close_fee = ns.close_fee + (t.close_fee or 0) %} {% endfor %} +{% set net = ns.gross - ns.open_fee - ns.close_fee %}
- 盈亏合计 {% if ns.total_pnl > 0 %}+{% endif %}{{ '%.2f'|format(ns.total_pnl) }} + 平仓盈亏 {% if ns.gross > 0 %}+{% endif %}{{ '%.2f'|format(ns.gross) }} | - 开仓手续费 {{ '%.2f'|format(ns.total_open_fee) }} + 开仓手续费 {{ '%.2f'|format(ns.open_fee) }} | - 平仓手续费 {{ '%.2f'|format(ns.total_close_fee) }} + 平仓手续费 {{ '%.2f'|format(ns.close_fee) }} | - 手续费合计 {{ '%.2f'|format(ns.total_open_fee + ns.total_close_fee) }} + 收益 {% if net > 0 %}+{% endif %}{{ '%.2f'|format(net) }}
{% else %}
暂无已平仓记录