{% extends "base.html" %} {% block title %}平仓汇总{% endblock %} {% block heading %}平仓汇总{% endblock %} {% block breadcrumb %}全部已平仓统计{% endblock %} {% block content %} {% set view = request.query_params.get('view', '') %} {# ── 总览卡片 ── #}
总平仓笔数
{{ total_count }}
总盈亏
{% if total_pnl > 0 %}+{% endif %}{{ "%.0f"|format(total_pnl) }}
总手续费
{{ "%.0f"|format(total_fee) }}
总胜率
{{ total_win_rate }}%
净盈亏
{% set net = total_pnl - total_fee %} {% if net > 0 %}+{% endif %}{{ "%.0f"|format(net) }}
{# ── 按类型分拆 ── #}
📝 期货 📊 期权 🎯 双买
{# ═══════════ 期货 ═══════════ #}
笔数 {{ future_stats.count }} 盈亏 {% if future_stats.pnl > 0 %}+{% endif %}{{ "%.0f"|format(future_stats.pnl) }} 手续费 {{ "%.0f"|format(future_stats.total_fee) }} 胜率 {{ future_stats.win_rate }}%
{% if future_trades %}
{% for t in future_trades %} {% endfor %}
品种合约方向开仓日平仓日持仓开仓价平仓价盈亏
{{ t.product_code }} {{ t.contract_code.replace(t.product_code, '', 1) if t.contract_code.startswith(t.product_code) else t.contract_code }} {% if t.direction == 'long' %} {% else %} {% endif %} {{ t.open_date }} {{ weekdays[t.open_date.weekday()] }} {{ t.close_date }} {{ weekdays[t.close_date.weekday()] }} {{ (t.close_date - t.open_date).days }}天 {{ t.open_price }} {{ t.close_price }} {% set p = t.pnl %} {% if p is not none %} {% if p > 0 %}+{% endif %}{{ p }} {% endif %}
{% else %}
暂无已平仓记录
{% endif %}
{# ═══════════ 期权 ═══════════ #}
笔数 {{ option_stats.count }} 盈亏 {% if option_stats.pnl > 0 %}+{% endif %}{{ "%.0f"|format(option_stats.pnl) }} 手续费 {{ "%.0f"|format(option_stats.total_fee) }} 胜率 {{ option_stats.win_rate }}%
{% if option_trades %}
{% for t in option_trades %} {% endfor %}
品种合约类型买卖行权价开仓日平仓日持仓开仓价平仓价盈亏
{{ t.product_code }} {{ t.contract_code.replace(t.product_code, '', 1) if t.contract_code.startswith(t.product_code) else t.contract_code }} {% if t.option_type == 'C' %} C {% else %} P {% endif %} {% if t.direction == 'buy' %} {% else %} {% endif %} {{ t.strike_price }} {{ t.open_date }} {{ weekdays[t.open_date.weekday()] }} {{ t.close_date }} {{ weekdays[t.close_date.weekday()] }} {{ (t.close_date - t.open_date).days }}天 {{ t.open_price }} {{ t.close_price }} {% set p = t.pnl %} {% if p is not none %} {% if p > 0 %}+{% endif %}{{ p }} {% endif %}
{% else %}
暂无已平仓记录
{% endif %}
{# ═══════════ 双买 ═══════════ #}
笔数 {{ dual_stats.count }} 盈亏 {% if dual_stats.pnl > 0 %}+{% endif %}{{ "%.0f"|format(dual_stats.pnl) }} 手续费 {{ "%.0f"|format(dual_stats.total_fee) }} 胜率 {{ dual_stats.win_rate }}%
{% if dual_trades %}
{% for t in dual_trades %} {% endfor %}
品种合约C行权价P行权价开仓日平仓日持仓看涨(开/平)看跌(开/平)盈亏
{{ t.product_code }} {{ t.contract_code.replace(t.product_code, '', 1) if t.contract_code.startswith(t.product_code) else t.contract_code }} {{ t.call_strike_price }} {{ t.put_strike_price }} {{ t.open_date }} {{ weekdays[t.open_date.weekday()] }} {{ t.close_date }} {{ weekdays[t.close_date.weekday()] }} {{ (t.close_date - t.open_date).days }}天 {{ t.call_open_price }} / {{ t.call_close_price }} {{ t.put_open_price }} / {{ t.put_close_price }} {% set p = t.pnl %} {% if p is not none %} {% if p > 0 %}+{% endif %}{{ p }} {% endif %}
{% else %}
暂无已平仓记录
{% endif %}
{% endblock %}