feat: 交易记录增加保证金占比与最新资金,上方展示资金曲线

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 16:17:22 +08:00
parent 649c064c2f
commit 240fbe7994
5 changed files with 184 additions and 13 deletions
+27 -7
View File
@@ -1,6 +1,13 @@
{% extends "base.html" %}
{% block title %}交易记录与复盘 - 国内期货监控系统{% endblock %}
{% block content %}
<div class="card records-equity-card" style="margin-bottom:1.25rem">
<h2>资金曲线</h2>
<div class="card-body">
<div id="equity-curve-chart" style="width:100%;min-height:220px;border-radius:6px;overflow:hidden"></div>
</div>
</div>
<div class="card records-trade-card" style="margin-bottom:1.25rem">
<h2>交易记录</h2>
<div class="card-body">
@@ -14,9 +21,9 @@
<tr>
<th>品种</th><th>类型</th><th>方向</th>
<th>成交</th><th>止损(开仓)</th><th>止盈</th>
<th></th><th>杠杆</th><th>持仓分钟</th>
<th></th><th>保证金</th><th>保证金占比</th><th>持仓分钟</th>
<th>开仓时间</th><th>平仓时间</th>
<th>盈亏(元)</th><th>手续费</th><th>净盈亏</th><th>结果</th><th>操作</th>
<th>盈亏(元)</th><th>手续费</th><th>净盈亏</th><th>最新资金</th><th>结果</th><th>操作</th>
</tr>
</thead>
<tbody>
@@ -49,11 +56,18 @@
<input class="cell-edit-show" type="number" step="0.0001" name="take_profit" value="{{ t.take_profit }}" style="display:none">
</td>
<td>
<span class="cell-readonly cell-edit-hide">{{ t.lots }}手 / {{ t.margin or '-' }}</span>
<input class="cell-edit-show" type="number" step="0.01" name="margin" value="{{ t.margin or '' }}" placeholder="保证金" style="display:none">
<input type="hidden" name="lots" value="{{ t.lots }}">
<span class="cell-readonly cell-edit-hide">{{ t.lots }}</span>
<input class="cell-edit-show" type="number" step="0.01" name="lots" value="{{ t.lots }}" style="display:none">
</td>
<td>
<span class="cell-readonly cell-edit-hide">{{ t.margin if t.margin is not none else '-' }}</span>
<input class="cell-edit-show" type="number" step="0.01" name="margin" value="{{ t.margin or '' }}" placeholder="保证金" style="display:none">
</td>
<td>
<span class="cell-readonly cell-edit-hide">
{% if t.margin_pct is not none %}{{ t.margin_pct }}%{% else %}-{% endif %}
</span>
</td>
<td><span class="cell-readonly"></span></td>
<td>
<span class="cell-readonly cell-edit-hide">{{ t.holding_minutes or 0 }}</span>
<input class="cell-edit-show" type="number" name="holding_minutes" value="{{ t.holding_minutes or 0 }}" style="display:none">
@@ -80,6 +94,9 @@
{{ t.pnl_net if t.pnl_net is not none else '-' }}
</span>
</td>
<td>
<span class="cell-readonly">{{ t.equity_after if t.equity_after is not none else '-' }}</span>
</td>
<td>
<span class="cell-readonly cell-edit-hide">
{% if t.result == '止盈' %}<span class="badge profit">{{ t.result }}</span>
@@ -107,7 +124,7 @@
</td>
</tr>
{% else %}
<tr><td colspan="16" class="text-muted">暂无交易记录</td></tr>
<tr><td colspan="18" class="text-muted">暂无交易记录</td></tr>
{% endfor %}
</tbody>
</table>
@@ -298,6 +315,9 @@
{% endif %}
{% endblock %}
{% block extra_js %}
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
<script>window.__EQUITY_CURVE__ = {{ equity_curve | default([]) | tojson }};</script>
<script src="{{ url_for('static', filename='js/equity_curve.js') }}"></script>
<script src="{{ url_for('static', filename='js/review.js') }}"></script>
<script src="{{ url_for('static', filename='js/trades.js') }}"></script>
{% if prefill %}