bea7804d47
Co-authored-by: Cursor <cursoragent@cursor.com>
124 lines
5.2 KiB
HTML
124 lines
5.2 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}统计分析 - 国内期货监控系统{% endblock %}
|
|
{% block content %}
|
|
|
|
<div class="stat-grid">
|
|
<div class="stat-item"><div class="label">总交易</div><div class="value">{{ total }}</div></div>
|
|
<div class="stat-item"><div class="label">止盈</div><div class="value text-profit">{{ win }}</div></div>
|
|
<div class="stat-item"><div class="label">止损</div><div class="value text-loss">{{ loss }}</div></div>
|
|
<div class="stat-item"><div class="label">胜率</div><div class="value">{{ rate }}%</div></div>
|
|
</div>
|
|
|
|
<div class="stat-grid">
|
|
<div class="stat-item"><div class="label">累计手续费</div><div class="value text-loss">{{ total_fee }} 元</div></div>
|
|
<div class="stat-item"><div class="label">毛盈亏合计</div><div class="value">{{ total_gross }} 元</div></div>
|
|
<div class="stat-item"><div class="label">净盈亏合计</div><div class="value {% if total_net > 0 %}text-profit{% elif total_net < 0 %}text-loss{% endif %}">{{ total_net }} 元</div></div>
|
|
<div class="stat-item"><div class="label">计费笔数</div><div class="value">{{ fee_count }}</div></div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>按品种统计</h2>
|
|
<table>
|
|
<thead><tr><th>品种</th><th>交易次数</th><th>止盈次数</th><th>胜率</th></tr></thead>
|
|
<tbody>
|
|
{% for s in by_symbol %}
|
|
<tr>
|
|
<td>{{ s.symbol_name or s.symbol }}</td>
|
|
<td>{{ s.cnt }}</td>
|
|
<td>{{ s.wins }}</td>
|
|
<td>{{ round(s.wins / s.cnt * 100, 2) if s.cnt else 0 }}%</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="4" class="text-muted">暂无数据</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>手续费按品种(交易记录)</h2>
|
|
<table>
|
|
<thead><tr><th>品种</th><th>笔数</th><th>累计手续费(元)</th></tr></thead>
|
|
<tbody>
|
|
{% for f in fee_by_symbol %}
|
|
<tr>
|
|
<td>{{ f.symbol_name or f.symbol }}</td>
|
|
<td>{{ f.cnt }}</td>
|
|
<td class="text-loss">{{ round(f.total_fee, 2) }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="3" class="text-muted">暂无手续费数据</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>按类型统计</h2>
|
|
<table>
|
|
<thead><tr><th>类型</th><th>交易次数</th><th>止盈次数</th><th>胜率</th></tr></thead>
|
|
<tbody>
|
|
{% for t in by_type %}
|
|
<tr>
|
|
<td>{{ t.monitor_type }}</td>
|
|
<td>{{ t.cnt }}</td>
|
|
<td>{{ t.wins }}</td>
|
|
<td>{{ round(t.wins / t.cnt * 100, 2) if t.cnt else 0 }}%</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="4" class="text-muted">暂无数据</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>按方向统计</h2>
|
|
<table>
|
|
<thead><tr><th>方向</th><th>交易次数</th><th>止盈次数</th><th>胜率</th></tr></thead>
|
|
<tbody>
|
|
{% for d in by_direction %}
|
|
<tr>
|
|
<td><span class="badge dir">{{ '做多' if d.direction == 'long' else '做空' }}</span></td>
|
|
<td>{{ d.cnt }}</td>
|
|
<td>{{ d.wins }}</td>
|
|
<td>{{ round(d.wins / d.cnt * 100, 2) if d.cnt else 0 }}%</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="4" class="text-muted">暂无数据</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h2>最近 10 笔交易记录</h2>
|
|
<table>
|
|
<thead><tr><th>品种</th><th>方向</th><th>毛盈亏</th><th>手续费</th><th>净盈亏</th><th>结果</th><th>时间</th></tr></thead>
|
|
<tbody>
|
|
{% for r in recent %}
|
|
<tr>
|
|
<td>{{ r.symbol_name or r.symbol }}</td>
|
|
<td><span class="badge dir">{{ '做多' if r.direction == 'long' else '做空' }}</span></td>
|
|
<td>{{ r.pnl if r.pnl is not none else '-' }}</td>
|
|
<td class="text-muted">{{ r.fee if r.fee is not none else '-' }}</td>
|
|
<td>
|
|
{% if r.pnl_net and r.pnl_net > 0 %}<span class="badge profit">{{ r.pnl_net }}</span>
|
|
{% elif r.pnl_net and r.pnl_net < 0 %}<span class="badge loss">{{ r.pnl_net }}</span>
|
|
{% else %}-{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if r.result == '止盈' %}<span class="badge profit">止盈</span>
|
|
{% elif r.result == '止损' %}<span class="badge loss">止损</span>
|
|
{% else %}{{ r.result or '-' }}{% endif %}
|
|
</td>
|
|
<td>{{ r.close_time[:16] if r.close_time else (r.created_at[:16] if r.created_at else '') }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="7" class="text-muted">暂无数据</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endblock %}
|