From f8ff97f93d3c51734ffba1c26b77bb0d306ea690 Mon Sep 17 00:00:00 2001 From: dekun Date: Mon, 29 Jun 2026 07:46:58 +0800 Subject: [PATCH] Add collapsible rule descriptions to trade, strategy, and key pages. Shared module-rules styling; key monitor rules collapsed by default like other modules. Co-authored-by: Cursor --- static/css/base.css | 8 ++++++++ static/css/keys.css | 5 ----- templates/keys.html | 4 ++-- templates/strategy.html | 18 ++++++++++++++++++ templates/trade.html | 23 +++++++++++++++++++++++ 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/static/css/base.css b/static/css/base.css index 5f9a8a6..118707f 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -203,6 +203,14 @@ border-radius:2px;box-shadow:0 0 8px var(--card-glow); .form-compact .symbol-wrap{display:flex;flex-direction:column;align-self:stretch} .form-compact .symbol-wrap>label.text-label,.form-compact .symbol-wrap>label.symbol-field-label{margin-bottom:.28rem} .form-compact .symbol-selected{font-size:.68rem;margin:0} +.module-rules{margin-bottom:.75rem;font-size:.82rem;color:var(--text-muted)} +.module-rules summary{cursor:pointer;color:var(--accent);font-weight:600;margin-bottom:0;list-style:none} +.module-rules summary::-webkit-details-marker{display:none} +.module-rules[open] summary{margin-bottom:.35rem} +.module-rules-body{padding:.35rem 0 .15rem} +.module-rules-body ul{margin:.25rem 0 .5rem 1.1rem;padding:0} +.module-rules-body li{margin:.15rem 0} +.module-rules-body p{margin:.35rem 0 .25rem} .form-compact button.btn-primary{padding:.55rem 1.5rem;font-size:.85rem;white-space:nowrap} .form-compact-review input.calc-readonly{color:var(--accent);background:var(--calc-bg);font-size:.82rem} .form-compact-review textarea{min-height:44px;font-size:.85rem;padding:.45rem .65rem} diff --git a/static/css/keys.css b/static/css/keys.css index fa7586e..ce24426 100644 --- a/static/css/keys.css +++ b/static/css/keys.css @@ -1,8 +1,3 @@ -.key-rules{margin-bottom:.75rem;font-size:.82rem;color:var(--text-muted)} -.key-rules summary{cursor:pointer;color:var(--accent);font-weight:600;margin-bottom:.35rem} -.key-rules-body{padding:.35rem 0 .15rem} -.key-rules-body ul{margin:.25rem 0 .5rem 1.1rem;padding:0} -.key-rules-body li{margin:.15rem 0} .key-form-rows{display:flex;flex-direction:column;gap:.75rem;margin-bottom:.85rem} .key-form-line{display:grid;gap:.65rem;align-items:end} .key-form-line.line-3{grid-template-columns:1.4fr .85fr .85fr} diff --git a/templates/keys.html b/templates/keys.html index 31a99b1..86611c4 100644 --- a/templates/keys.html +++ b/templates/keys.html @@ -9,9 +9,9 @@

新增监控

-
+
规则说明 -
+

箱体突破 / 收敛突破(自动单)

  • 触发:上周期 K 线收盘收在上沿或下沿之外(默认 5 分)
  • diff --git a/templates/strategy.html b/templates/strategy.html index 5f2e93d..a710c41 100644 --- a/templates/strategy.html +++ b/templates/strategy.html @@ -20,6 +20,24 @@ {% endblock %} {% block content %}
    +
    + 规则说明 +
    +

    趋势回调

    +
      +
    • 填写品种、方向、周期、止损、补仓边界、止盈 → 预览计划 → 确认后市价开首仓
    • +
    • 须 CTP 已连接、交易时段内、账户风控允许开仓
    • +
    • 运行中:价格触及止盈 → 全部平仓结案;回落至网格档位 → 自动分档补仓
    • +
    • 可手动「结束计划」;记录归档至策略交易记录
    • +
    +

    顺势加仓(滚仓)

    +
      +
    • 在「下单监控」已有 active 持仓监控 上扩大仓位,统一抬高止损
    • +
    • 预览后执行;仓位上限冻结时仍可滚仓,但受滚仓保证金上限约束
    • +
    • 最多 3 腿;止盈锁定首仓逻辑
    • +
    +
    +

    趋势回调

    diff --git a/templates/trade.html b/templates/trade.html index 7294237..1472c00 100644 --- a/templates/trade.html +++ b/templates/trade.html @@ -60,6 +60,29 @@
    +
    + 规则说明 +
    +

    开仓

    +
      +
    • CTP 已连接 且处于交易时段;账户风控允许(顶栏状态)
    • +
    • 固定金额计仓、开启移动保本时须填写止损
    • +
    • 手数:固定手数,或按止损距离与单笔风险金额自动计算;保证金占用不超过系统设置上限
    • +
    • 限价未成交 → 挂单中,超时自动撤单(系统设置可改分钟数)
    • +
    +

    止盈 / 止损 / 移动保本

    +
      +
    • 成交后由程序本地监控;触及止盈或止损 → 市价平仓
    • +
    • 移动保本:须填止损、不设固定止盈;达 1R 止损移至开仓±缓冲跳,2R 移 1R,依次类推
    • +
    • 手动平仓写入交易记录;当日手动平仓次数超限 → 进入冷静期
    • +
    +

    可开仓品种表

    +
      +
    • 按权益与保证金上限筛选;权益 ≤20 万或 CTP 未连接时仅四品种(玉米、豆粕、甲醇、螺纹钢)
    • +
    +
    +
    +