{# Copyright (c) 2025-2026 马建军. All rights reserved. 专有软件,详见 LICENSE.zh-CN.txt #} {% extends "base.html" %} {% block title %}交易记录与复盘 - 国内期货 · 交易复盘系统{% endblock %} {% block extra_css %} {% endblock %} {% block content %} {% macro trade_detail_json(t) -%} {{ { "id": t.id, "symbol": t.symbol_name or t.symbol, "symbol_code": t.symbol, "symbol_name": t.symbol_name or t.symbol, "monitor_type": t.monitor_type, "source": "柜台" if t.source == "ctp" else "本地", "direction": "做多" if t.direction == "long" else "做空", "direction_code": t.direction, "entry_price": t.entry_price, "close_price": t.close_price, "stop_loss": t.stop_loss, "take_profit": t.take_profit, "lots": t.lots, "margin": t.margin, "margin_pct": t.margin_pct, "holding_minutes": t.holding_minutes or 0, "open_time": t.open_time, "close_time": t.close_time, "pnl": t.pnl, "fee": t.fee, "pnl_net": t.pnl_net, "equity_after": t.equity_after, "result": t.result, "verified": t.verified, "fill_review_url": url_for("fill_review_from_trade", tid=t.id), "del_url": url_for("del_trade", tid=t.id) } | tojson }} {%- endmacro %} {% macro trade_symbol_cell(t) %}
已连接 CTP,本页已自动同步柜台成交(新增 {{ ctp_sync_info.synced or 0 }} 条,更新 {{ ctp_sync_info.updated or 0 }} 条)。 带来源「柜台」的记录以交易所成交为准;「本地」为程序写入,可手动删除错误项。
{% else %}CTP 未连接时仅显示本地数据库记录;连接后打开本页会自动同步柜台成交。
{% endif %}跨日持仓的盈亏以平仓价与柜台结算为准;表格中「开仓价」为程序记录,「平仓价」为成交回报,二者不一致时请以平仓价核对净盈亏。
暂无交易记录
{% endfor %}| 品种 | 方向 | 手数 | 开仓 | 平仓 | 盈亏 | 净盈亏 | 平仓时间 | 操作 |
|---|---|---|---|---|---|---|---|---|
| {{ trade_symbol_cell(t) }} | {{ '做多' if t.direction == 'long' else '做空' }} | {% if t.lots is not none %}{{ '%.2f'|format(t.lots|float) }}{% else %}—{% endif %} | {% if t.entry_price is not none %}{{ '%.2f'|format(t.entry_price|float) }}{% else %}—{% endif %} | {% if t.close_price is not none %}{{ '%.2f'|format(t.close_price|float) }}{% elif t.entry_price is not none %}{{ '%.2f'|format(t.entry_price|float) }}{% else %}—{% endif %} | {{ trade_pnl_cell(t.pnl) }} | {{ trade_pnl_cell(t.pnl_net) }} | {{ (t.close_time or '')[:16].replace('T', ' ') or '—' }} | {{ trade_row_actions(t, 'records-tablet-detail-btn') }} |
| 暂无交易记录 | ||||||||
| 品种 | 类型 | 方向 | 开仓价 | 平仓价 | 止损(开仓) | 止盈 | 手数 | 保证金 | 保证金占比 | 持仓分钟 | 开仓时间 | 平仓时间 | 盈亏(元) | 手续费 | 净盈亏 | 最新资金 | 结果 | 操作 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ t.symbol_name or t.symbol }} | {{ t.monitor_type }} {% if t.source == 'ctp' %} 柜台 {% else %} 本地 {% endif %} | {{ '做多' if t.direction == 'long' else '做空' }} | {% if t.entry_price is not none %}{{ '%.2f'|format(t.entry_price|float) }}{% else %}—{% endif %} | {% if t.close_price is not none %}{{ '%.2f'|format(t.close_price|float) }}{% else %}—{% endif %} | {% if t.stop_loss is not none %}{{ '%.2f'|format(t.stop_loss|float) }}{% else %}—{% endif %} | {% if t.take_profit is not none %}{{ '%.2f'|format(t.take_profit|float) }}{% else %}—{% endif %} | {% if t.lots is not none %}{{ '%.2f'|format(t.lots|float) }}{% else %}—{% endif %} | {% if t.margin is not none %}{{ '%.2f'|format(t.margin|float) }}{% else %}—{% endif %} | {% if t.margin_pct is not none %}{{ t.margin_pct }}%{% else %}—{% endif %} | {{ t.holding_minutes or 0 }} | {{ (t.open_time or '')[:16].replace('T',' ') or '—' }} | {{ (t.close_time or '')[:16].replace('T',' ') or '—' }} | {{ t.pnl if t.pnl is not none else '—' }} | {{ t.fee if t.fee is not none else '—' }} | {{ t.pnl_net if t.pnl_net is not none else '—' }} | {{ t.equity_after if t.equity_after is not none else '—' }} | {% if t.result == '止盈' %}{{ t.result }} {% elif t.result == '止损' %}{{ t.result }} {% elif t.result == '移动止盈' %}{{ t.result }} {% elif t.result == '保本止盈' %}{{ t.result }} {% elif t.result == '手动平仓' %}{{ t.result }} {% else %}{{ t.result }}{% endif %} {% if t.verified %}已核对{% endif %} | |
| 暂无交易记录 | ||||||||||||||||||
暂无复盘记录
{% endfor %}| 平仓 | 品种 | 方向 | 盈亏 | 手续费 | 净盈亏 | 情绪单 | 详情 | |
|---|---|---|---|---|---|---|---|---|
| {{ r.close_time[:16] if r.close_time else '' }} | {{ r.symbol_name or r.symbol }} | {{ '多' if r.direction == 'long' else '空' }} | {% if r.pnl and r.pnl > 0 %}{{ r.pnl }} {% elif r.pnl and r.pnl < 0 %}{{ r.pnl }} {% else %}{{ r.actual_pnl or '-' }}{% endif %} | {{ r.fee if r.fee is not none else '-' }} | {% if r.pnl_net and r.pnl_net > 0 %}{{ r.pnl_net }} {% elif r.pnl_net and r.pnl_net < 0 %}{{ r.pnl_net }} {% else %}-{% endif %} | {% if r.is_emotion %}情绪单{% else %}-{% endif %} | 删 | |
| 暂无复盘记录 | ||||||||
| 品种 | 类型 | 方向 | 触发价 | 结果 | 时间 |
|---|---|---|---|---|---|
| {{ r.symbol_name or r.symbol }} | {{ r.monitor_type }} | {{ '多' if r.direction == 'long' else '空' }} | {{ r.trigger_price }} | {% if r.result == '止盈' %}止盈{% else %}止损{% endif %} | {{ r.created_at[:16] if r.created_at else '' }} |