数据统计页:多机 KPI 对比与余额曲线采样。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-03 02:59:20 +08:00
parent 16f32fec2a
commit 36fbcc2d1b
11 changed files with 1036 additions and 48 deletions
+2 -1
View File
@@ -6,11 +6,12 @@
<title>{% block title %}期权中控{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}">
</head>
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path == '/' %}page-dashboard{% endif %}">
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path.startswith('/stats') %}page-stats{% elif request.path == '/' %}page-dashboard{% endif %}">
{% if session.get('logged_in') %}
<header class="topbar">
<nav>
<a href="/" class="{% if request.path == '/' %}active{% endif %}">总览</a>
<a href="/stats" class="{% if request.path.startswith('/stats') %}active{% endif %}">数据统计</a>
<a href="/cond_orders" class="{% if request.path.startswith('/cond_orders') %}active{% endif %}">条件单</a>
<a href="/instances" class="{% if request.path.startswith('/instances') %}active{% endif %}">实例</a>
<a href="/desk" class="{% if request.path.startswith('/desk') %}active{% endif %}">工作台</a>
+74
View File
@@ -0,0 +1,74 @@
{% extends "base.html" %}
{% block title %}数据统计 · 期权中控{% endblock %}
{% block body %}
<section class="page-head stats-head">
<div>
<p class="settings-eyebrow">Analytics</p>
<h1>数据统计</h1>
<p class="muted settings-lead">多机 KPI 对比与余额曲线(不含权利金/浮盈)。详情仍在工作台查看。</p>
</div>
<div class="stats-window-tabs" id="stats-window-tabs" role="tablist">
<button type="button" class="stats-win-btn" data-window="today">今日</button>
<button type="button" class="stats-win-btn is-active" data-window="7d">近7日</button>
<button type="button" class="stats-win-btn" data-window="30d">近30日</button>
<button type="button" class="stats-win-btn" data-window="all">全部</button>
</div>
</section>
<p class="muted" id="stats-status">加载中…</p>
<section class="panel stats-kpi-panel" id="stats-kpi-panel">
<div class="stats-kpi-grid" id="stats-kpi-grid"></div>
</section>
<section class="panel stats-curve-panel">
<div class="stats-card-head-inline">
<div>
<h2>余额曲线</h2>
<p class="muted">主指标为账户现金余额,不含已用权利金与浮盈。采样开启后往后累计。</p>
</div>
<label class="stats-curve-toggle">
<input type="checkbox" id="stats-show-machines" checked>
叠加各机
</label>
</div>
<div class="stats-chart-wrap">
<canvas id="stats-curve-canvas" width="960" height="320"></canvas>
<div class="stats-chart-empty muted" id="stats-curve-empty" hidden>暂无采样数据,后台巡检运行后会逐渐出现。</div>
</div>
<div class="stats-legend" id="stats-curve-legend"></div>
</section>
<section class="panel stats-table-panel">
<div class="stats-card-head-inline">
<div>
<h2>机器对比</h2>
<p class="muted">实时资金状态 + 当前窗口交易 KPI。</p>
</div>
</div>
<div class="overview-table-wrap">
<table class="overview-table stats-table" id="stats-table">
<thead>
<tr>
<th>机器</th>
<th>状态</th>
<th>余额</th>
<th>权利金</th>
<th>浮盈</th>
<th>笔数</th>
<th>胜率</th>
<th>已实现</th>
<th>均持仓</th>
<th></th>
</tr>
</thead>
<tbody id="stats-table-body">
<tr><td colspan="10" class="muted">加载中…</td></tr>
</tbody>
</table>
</div>
</section>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='stats.js') }}?v=1"></script>
{% endblock %}