{# 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) -%} {{ { "symbol": t.symbol_name or t.symbol, "symbol_code": t.symbol, "monitor_type": t.monitor_type, "source": "柜台" if t.source == "ctp" else "本地", "direction": "做多" if t.direction == "long" else "做空", "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) %}
{{ t.symbol_name or t.symbol }} {% if t.symbol_exchange %}{{ t.symbol_exchange }}{% endif %} {% if t.symbol_is_main %}主力{% endif %} {% if t.symbol and (t.symbol_name or '')|lower != (t.symbol or '')|lower %} {{ t.symbol }} {% endif %}
{% endmacro %} {% macro trade_pnl_cell(v) %} {% if v is not none %}{% set n = v|float %}{{ ('+' if n > 0 else '') ~ ('%.2f'|format(n)) }} 元{% else %}—{% endif %} {% endmacro %} {% macro trade_verify_form(t) %}
{% endmacro %} {% macro trade_row_actions(t, detail_class) %}
填入复盘 {{ trade_verify_form(t) }} 删除
{% endmacro %}

资金曲线

交易记录

{% if ctp_sync_info and ctp_sync_info.connected %}

已连接 CTP,本页已自动同步柜台成交(新增 {{ ctp_sync_info.synced or 0 }} 条,更新 {{ ctp_sync_info.updated or 0 }} 条)。 带来源「柜台」的记录以交易所成交为准;「本地」为程序写入,可手动删除错误项。

{% else %}

CTP 未连接时仅显示本地数据库记录;连接后打开本页会自动同步柜台成交。

{% endif %}

跨日持仓的盈亏以平仓价与柜台结算为准;表格中「开仓价」为程序记录,「平仓价」为成交回报,二者不一致时请以平仓价核对净盈亏。

{% for t in trades %} {% set trade_pnl = t.pnl_net if t.pnl_net is not none else t.pnl %} {% set trade_px = t.close_price if t.close_price else t.entry_price %} {% set pnl_cls = 'is-profit' if trade_pnl and trade_pnl > 0 else ('is-loss' if trade_pnl and trade_pnl < 0 else 'is-flat') %}
{{ t.symbol_name or t.symbol }} {% if t.symbol and (t.symbol_name or '')|lower != (t.symbol or '')|lower %} {{ t.symbol }} {% endif %} {{ '做多' if t.direction == 'long' else '做空' }} {% if t.verified %}已核对{% endif %}
{{ (t.lots or 0)|int }}手 平仓 {{ trade_px if trade_px is not none else '-' }} 盈亏 {{ trade_pnl if trade_pnl is not none else '-' }}
详情 ›
{% else %}

暂无交易记录

{% endfor %}
{% for t in trades %} {% else %} {% 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') }}
暂无交易记录
{% for t in trades %} {% else %} {% endfor %}
品种类型方向 开仓价平仓价止损(开仓)止盈 手数保证金保证金占比持仓分钟 开仓时间平仓时间 盈亏(元)手续费净盈亏最新资金结果操作
{{ t.symbol_name or t.symbol }} {{ t.monitor_type }} {% if t.source == 'ctp' %} 柜台 {% else %} 本地 {% endif %} {{ '做多' if t.direction == 'long' else '做空' }} {{ t.entry_price if t.entry_price is not none else '-' }} {{ t.close_price if t.close_price is not none else '-' }} {{ t.stop_loss }} {{ t.take_profit }} {{ t.lots }} {{ t.margin if t.margin is not none else '-' }} {% if t.margin_pct is not none %}{{ t.margin_pct }}%{% else %}-{% endif %} {{ t.holding_minutes or 0 }} {{ (t.open_time or '')[:16].replace('T',' ') }} {{ (t.close_time or '')[:16].replace('T',' ') }} {{ 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 %}
填入复盘 删除
暂无交易记录

复盘上传

开仓时间
平仓时间

勾选行为标签即为情绪单

{% for tag in behavior_tags %} {% endfor %}

复盘历史

{% if preset == 'custom' or start or end %}
{% endif %}
{% for r in reviews %} {% else %}

暂无复盘记录

{% endfor %}
{% for r in reviews %} {% else %} {% 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 %}
暂无复盘记录
{% if auto_records %}

系统自动记录(止盈/止损)

{% for r in auto_records %} {% endfor %}
品种类型方向触发价结果时间
{{ 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 '' }}
{% endif %}
{% endblock %} {% block extra_js %} {% if prefill %} {% endif %} {% endblock %}