Add real-time data dashboard with account, positions, keys, and closes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-29 21:30:33 +08:00
parent df79017b30
commit 28c54b1a3f
7 changed files with 750 additions and 0 deletions
+1
View File
@@ -81,6 +81,7 @@
<button type="button" class="nav-backdrop" id="nav-backdrop" aria-label="关闭菜单" hidden></button>
<nav class="site-nav" id="site-nav">
<a href="{{ url_for('positions') }}" class="{% if request.endpoint in ('positions', 'trade_page', 'recommend_page') %}active{% endif %}">下单监控</a>
{% if nav_items.dashboard %}<a href="{{ url_for('dashboard') }}" class="{% if request.endpoint == 'dashboard' %}active{% endif %}">数据看板</a>{% endif %}
{% if nav_items.strategy %}<a href="{{ url_for('strategy_page') }}" class="{% if request.endpoint in ('strategy_page', 'strategy_records_page') %}active{% endif %}">策略交易</a>{% endif %}
{% if nav_items.plans %}<a href="{{ url_for('plans') }}" class="{% if request.endpoint == 'plans' %}active{% endif %}">开单计划</a>{% endif %}
<a href="{{ url_for('keys') }}" class="{% if request.endpoint == 'keys' %}active{% endif %}">关键位监控</a>
+108
View File
@@ -0,0 +1,108 @@
{# Copyright (c) 2025-2026 马建军. All rights reserved. 专有软件,详见 LICENSE.zh-CN.txt #}
{% extends "base.html" %}
{% block title %}数据看板 - 国内期货 · 交易复盘系统{% endblock %}
{% block extra_css %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}?v={{ asset_v }}">
{% endblock %}
{% block content %}
<div class="dashboard-page">
<div class="dashboard-top">
<div class="dashboard-top-left">
<span class="badge planned" id="dash-mode-badge"></span>
<span class="badge planned" id="dash-ctp-badge">CTP 检测中…</span>
<span class="text-muted dash-updated" id="dash-updated">正在加载…</span>
</div>
</div>
<div class="card dashboard-account-card">
<div class="stat-grid stat-grid-summary dashboard-account-grid">
<div class="stat-item">
<div class="label">账户权益</div>
<div class="value" id="dash-equity"></div>
</div>
<div class="stat-item">
<div class="label">占用保证金</div>
<div class="value" id="dash-margin"></div>
</div>
<div class="stat-item">
<div class="label">可用权益</div>
<div class="value" id="dash-available"></div>
</div>
</div>
</div>
<div class="card dashboard-section">
<h2>持仓信息</h2>
<div class="card-scroll">
<table class="dashboard-table" id="dash-positions-table">
<thead>
<tr>
<th>品种</th>
<th>方向</th>
<th>手数</th>
<th>均价</th>
<th>现价</th>
<th>浮盈亏</th>
<th>保证金</th>
<th>止损/止盈</th>
</tr>
</thead>
<tbody id="dash-positions-body">
<tr><td colspan="8" class="text-muted">加载中…</td></tr>
</tbody>
</table>
</div>
</div>
<div class="card dashboard-section">
<h2>关键位监控</h2>
<div class="card-scroll">
<table class="dashboard-table" id="dash-keys-table">
<thead>
<tr>
<th>品种</th>
<th>类型</th>
<th>周期</th>
<th>上沿</th>
<th>下沿</th>
<th>现价</th>
<th>距上沿</th>
<th>距下沿</th>
</tr>
</thead>
<tbody id="dash-keys-body">
<tr><td colspan="8" class="text-muted">加载中…</td></tr>
</tbody>
</table>
</div>
</div>
<div class="card dashboard-section">
<h2>平仓记录</h2>
<div class="card-scroll">
<table class="dashboard-table" id="dash-closes-table">
<thead>
<tr>
<th>品种</th>
<th>方向</th>
<th>手数</th>
<th>开仓</th>
<th>平仓</th>
<th>盈亏</th>
<th>净盈亏</th>
<th>平仓时间</th>
</tr>
</thead>
<tbody id="dash-closes-body">
<tr><td colspan="8" class="text-muted">加载中…</td></tr>
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script src="{{ url_for('static', filename='js/dashboard.js') }}?v={{ asset_v }}"></script>
{% endblock %}