Fix stats dirty data: today filter, exclude synthetic closes, scrub frozen float PnL.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,15 +2,26 @@
|
||||
{% block title %}统计看板 · {{ app_name }}{% endblock %}
|
||||
{% block content %}
|
||||
<h2 style="margin:0 0 6px">统计看板</h2>
|
||||
<p class="muted" style="margin:0 0 10px">程序汇总:顺势/反转 × 三种结构手法,其他=乱作。</p>
|
||||
<p class="muted" style="margin:0 0 10px">
|
||||
默认按北京时间<strong>今日真实平仓</strong>统计;对账/去重产生的假平仓已排除。
|
||||
{% if selected_period == 'today' and stats.day %}当前:{{ stats.day }}{% endif %}
|
||||
{% if stats.skipped_synthetic %} · 已排除假平仓 {{ stats.skipped_synthetic }} 笔{% endif %}
|
||||
</p>
|
||||
|
||||
<div style="display:flex;gap:8px;margin-bottom:14px;flex-wrap:wrap">
|
||||
<a class="btn secondary" href="{{ url_for('records_page', machine_id=selected_machine_id) if selected_machine_id else url_for('records_page') }}">交易列表</a>
|
||||
<a class="btn" href="{{ url_for('records_stats_page', machine_id=selected_machine_id) if selected_machine_id else url_for('records_stats_page') }}">统计看板</a>
|
||||
<a class="btn" href="{{ url_for('records_stats_page', machine_id=selected_machine_id, period=selected_period, day=selected_day) if selected_machine_id else url_for('records_stats_page', period=selected_period, day=selected_day) }}">统计看板</a>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-bottom:14px">
|
||||
<form method="get" action="{{ url_for('records_stats_page') }}" style="display:flex;gap:10px;align-items:center;flex-wrap:wrap">
|
||||
<label class="muted" for="period" style="margin:0">范围</label>
|
||||
<select name="period" id="period" style="min-width:120px;width:auto">
|
||||
<option value="today" {% if selected_period=='today' %}selected{% endif %}>今日</option>
|
||||
<option value="all" {% if selected_period=='all' %}selected{% endif %}>全部</option>
|
||||
</select>
|
||||
<label class="muted" for="day" style="margin:0">日期</label>
|
||||
<input type="date" name="day" id="day" value="{{ selected_day or '' }}" style="width:auto">
|
||||
<label class="muted" for="machine_id" style="margin:0">机器</label>
|
||||
<select name="machine_id" id="machine_id" style="min-width:200px;width:auto">
|
||||
<option value="">全部机器</option>
|
||||
@@ -21,9 +32,7 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit" class="btn">筛选</button>
|
||||
{% if selected_machine_id %}
|
||||
<a class="btn secondary" href="{{ url_for('records_stats_page') }}">清除</a>
|
||||
{% endif %}
|
||||
<a class="btn secondary" href="{{ url_for('records_stats_page') }}">今日重置</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +48,7 @@
|
||||
<div class="muted" style="margin-top:6px">盈 {{ stats.wins }} · 亏 {{ stats.losses }} · 平 {{ stats.breakeven }}</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="muted">合计盈亏</div>
|
||||
<div class="muted">合计盈亏{% if selected_period=='today' %}(今日已平){% endif %}</div>
|
||||
<div class="stat" style="color:{% if stats.profit>0 %}var(--green){% elif stats.profit<0 %}var(--red){% else %}inherit{% endif %}">
|
||||
{{ '%.2f'|format(stats.profit) }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user