{% extends "base.html" %}
{% block title %}交易记录{% endblock %}
{% block heading %}交易记录{% endblock %}
{% block breadcrumb %}开平仓记录{% endblock %}
{% block content %}
{% set view = request.query_params.get('view', '') %}
{# ═══════════════ 已平仓 ═══════════════ #}
{% if closed_trades %}
已平仓 · {{ closed_trades|length }} 笔
| 品种 | 合约 | 方向 | 开仓 | 平仓 | 开仓价 | 平仓价 | 开仓费 | 平仓费 | 盈亏 | 操作 |
{% for t in closed_trades %}
| {{ t.product_code }} |
{{ t.contract_code.replace(t.product_code, '', 1) }} |
{% if t.direction == 'short' %}
空
{% else %}
多
{% endif %}
|
{{ t.open_date }} |
{{ t.close_date }} |
{{ t.open_price }} |
{{ t.close_price }} |
{{ t.open_fee or 0 }} |
{{ t.close_fee or 0 }} |
{% set p = t.pnl %}
{% if p is not none %}
{% if p > 0 %}+{% endif %}{{ p }}
ⓘ
{% endif %}
|
|
{% endfor %}
{% set ns = namespace(total_pnl=0, total_open_fee=0, total_close_fee=0) %}
{% for t in closed_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) %}
{% endfor %}
盈亏合计 {% if ns.total_pnl > 0 %}+{% endif %}{{ '%.2f'|format(ns.total_pnl) }}
|
开仓手续费 {{ '%.2f'|format(ns.total_open_fee) }}
|
平仓手续费 {{ '%.2f'|format(ns.total_close_fee) }}
|
手续费合计 {{ '%.2f'|format(ns.total_open_fee + ns.total_close_fee) }}
{% else %}
暂无已平仓记录
{% endif %}
{% endif %}
{% if view != 'closed' %}
{% endif %}