本地监控止盈止损、盘前自动连CTP,并完善保证金与推荐手数。

- 止盈止损改为程序本地监控,触发后市价平仓(含跳空)
- 交易前30分钟后台自动连接 CTP
- 保证金占用上限默认30%,可在系统设置修改
- K线标准蜡烛图红跌绿涨,费率表全宽固定表头
- 品种推荐按保证金比例×总资金计算推荐手数

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-25 12:18:18 +08:00
parent fe1b651900
commit 9875ee6d44
15 changed files with 467 additions and 256 deletions
+4 -4
View File
@@ -19,7 +19,7 @@
</div>
<div class="trade-top-bar-actions">
<button type="button" class="btn-primary btn-ctp-sm" id="btn-ctp-connect">{% if ctp_status.connected %}重连 CTP{% else %}连接 CTP{% endif %}</button>
<span class="text-muted trade-top-hint">断线自动重连</span>
<span class="text-muted trade-top-hint">断线自动重连 · 开盘前 30 分钟自动连接</span>
</div>
</div>
@@ -107,7 +107,7 @@
<div class="card trade-card trade-card-full" id="recommend">
<h2>品种推荐</h2>
<div class="card-body">
<p class="hint">按权益 <strong class="text-accent" id="rec-capital">{{ '%.2f'|format(capital) }}</strong>筛选,仅显示可开 1 手的品种;参考止损/止盈按 20 跳、盈亏比 2:1 估算。
<p class="hint">按权益 <strong class="text-accent" id="rec-capital">{{ '%.2f'|format(capital) }}</strong> × 保证金上限 <strong>{{ max_margin_pct }}%</strong> 推荐手数;参考止损/止盈按 20 跳、盈亏比 2:1 估算。
{% if recommend_updated_at %}<span class="text-muted">每日后台更新 · 最近 {{ recommend_updated_at }}</span>{% else %}<span class="text-muted" id="rec-updated">等待今日后台刷新…</span>{% endif %}
</p>
<div class="trade-table-wrap">
@@ -116,7 +116,7 @@
<tr>
<th>品种</th><th>交易所</th><th>参考价</th>
<th>参考止损</th><th>参考止盈</th>
<th>1手保证金</th><th>1手手续费</th><th>建议最低资金</th><th>状态</th>
<th>1手保证金</th><th>1手手续费</th><th>推荐手数</th><th>状态</th>
</tr>
</thead>
<tbody id="recommend-list">
@@ -130,7 +130,7 @@
<td>{% if r.ref_take_profit %}{{ r.ref_take_profit }}{% else %}—{% endif %}</td>
<td>{% if r.margin_one_lot %}{{ r.margin_one_lot }}{% else %}—{% endif %}</td>
<td>{% if r.open_fee_one_lot is defined and r.open_fee_one_lot is not none %}{{ r.open_fee_one_lot }}{% else %}—{% endif %}</td>
<td>{% if r.min_capital_one_lot %}{{ r.min_capital_one_lot }}{% else %}—{% endif %}</td>
<td>{% if r.recommended_lots %}{{ r.recommended_lots }}{% else %}—{% endif %}</td>
<td><span class="badge {% if r.status=='ok' %}profit{% else %}planned{% endif %}">{{ r.status_label }}</span></td>
</tr>
{% endfor %}