Fix composite margin ratio cap at 50% and add risk guide page with nav toggle.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-29 22:29:13 +08:00
parent 9a10ac8a51
commit 8b4b1a875c
14 changed files with 392 additions and 34 deletions
+1
View File
@@ -82,6 +82,7 @@
<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.risk_guide %}<a href="{{ url_for('risk_guide') }}" class="{% if request.endpoint == 'risk_guide' %}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>
+4
View File
@@ -35,7 +35,11 @@
<div class="card dashboard-section dashboard-risk-card">
<h2 class="dashboard-risk-heading">
风控说明
{% if nav_items.risk_guide %}
<a class="dash-risk-doc-link" href="{{ url_for('risk_guide') }}">完整说明</a>
{% else %}
<span class="text-muted dash-risk-doc-ref">· 详见 <code>docs/风控说明.md</code></span>
{% endif %}
</h2>
<p class="dashboard-risk-reason" id="dash-risk-reason">加载中…</p>
<div class="stat-grid stat-grid-summary dashboard-risk-grid" id="dash-risk-grid"></div>
+13
View File
@@ -0,0 +1,13 @@
{# 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/doc.css') }}?v={{ asset_v }}">
{% endblock %}
{% block content %}
<div class="card doc-page">
<article class="doc-content">
{{ doc_html|safe }}
</article>
</div>
{% endblock %}
+3 -4
View File
@@ -218,11 +218,11 @@
<input name="fixed_amount" type="number" step="1" min="1" value="{{ fixed_amount }}">
</div>
<div class="field">
<label>保证金占用上限(%</label>
<label>单仓保证金上限(%</label>
<input name="max_margin_pct" type="number" step="1" min="1" max="100" value="{{ max_margin_pct }}">
</div>
<div class="field">
<label>滚仓保证金占用上限(%</label>
<label>综合保证金上限(%</label>
<input name="roll_max_margin_pct" type="number" step="1" min="1" max="100" value="{{ roll_max_margin_pct }}">
</div>
<div class="field">
@@ -236,8 +236,7 @@
</div>
<button type="submit" class="btn-primary" style="margin-top:.75rem">保存交易设置</button>
<p class="hint" style="margin-top:.75rem;margin-bottom:0">
仓保证金上限用于开仓校验与品种最大手数估算(默认 30%)。固定金额计仓时<strong>先按止损算手数,再按保证金上限收紧</strong>
滚仓保证金上限为滚仓后<strong>总持仓</strong>占用上限(默认 50%,可在下方修改)。
仓保证金上限(默认 30%)用于<strong>新开仓</strong>校验与最大手数估算;综合保证金上限(默认 50%在单仓模式下为滚仓合计上限、多仓模式下为全部持仓合计上限。固定金额计仓时<strong>先按止损算手数,再按单仓上限收紧</strong>
<strong>移动保本</strong>:达 1R 后止损移至开仓价 ± N 跳。
<strong>挂单超时</strong>:限价开仓未成交时,超过设定分钟数自动向柜台撤单(1~60 分钟)。
<span class="text-muted">{{ small_account_margin_rec.label }}。</span>