{% extends "base.html" %}
{% block title %}交易记录{% endblock %}
{% block heading %}交易记录{% endblock %}
{% block breadcrumb %}开平仓记录 · 盈亏统计{% endblock %}
{% block content %}
{# ═══════════════ 新建开仓 ═══════════════ #}
新建开仓
{# ═══════════════ 持仓中 ═══════════════ #}
持仓中 · {{ open_trades|length }} 笔
{% if open_trades %}
| 品种 | 合约 | 方向 | 开仓日期 | 开仓价 | 手续费 | 操作 |
{% for t in open_trades %}
| {{ t.product_code }} |
{{ t.contract_code }} |
{% if t.direction == 'short' %}
空
{% else %}
多
{% endif %}
|
{{ t.open_date }} |
{{ t.open_price }} |
{{ t.open_fee or 0 }} |
|
{% endfor %}
{% else %}
暂无持仓
{% endif %}
{# ═══════════════ 平仓表单(隐藏) ═══════════════ #}
{# ═══════════════ 已平仓 ═══════════════ #}
{% if closed_trades %}
已平仓 · {{ closed_trades|length }} 笔
| 品种 | 合约 | 方向 | 开仓 | 平仓 | 开仓价 | 平仓价 | 盈亏 | 操作 |
{% for t in closed_trades %}
| {{ t.product_code }} |
{{ t.contract_code }} |
{% if t.direction == 'short' %}
空
{% else %}
多
{% endif %}
|
{{ t.open_date }} |
{{ t.close_date }} |
{{ t.open_price }} |
{{ t.close_price }} |
{% set p = t.pnl %}
{% if p is not none %}
{% if p > 0 %}+{% endif %}{{ p }}
{% endif %}
|
|
{% endfor %}
{% endif %}
{% endblock %}