持仓监控页整合期货下单、持仓与品种推荐三卡片。
程序报单状态与推荐表内嵌同一页面,/recommend 跳转至 #recommend。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+77
-14
@@ -13,25 +13,88 @@
|
||||
<span class="badge {% if risk_status.can_trade %}profit{% else %}loss{% endif %}" id="risk-badge">{{ risk_status.status_label }}</span>
|
||||
<span class="text-muted">权益 <strong id="cap-display">{{ '%.2f'|format(capital) }}</strong> 元</span>
|
||||
{% if ctp_account.available is defined and ctp_status.connected %}
|
||||
<span class="text-muted">可用 <strong>{{ '%.2f'|format(ctp_account.available) }}</strong> 元</span>
|
||||
<span class="text-muted">可用 <strong id="avail-display">{{ '%.2f'|format(ctp_account.available) }}</strong> 元</span>
|
||||
{% endif %}
|
||||
<button type="button" class="btn-primary" id="btn-ctp-connect" style="padding:.4rem .9rem;font-size:.8rem">连接 CTP</button>
|
||||
</div>
|
||||
|
||||
<div class="trade-subnav">
|
||||
<span class="active">持仓监控</span>
|
||||
<a href="{{ url_for('recommend_page') }}">品种推荐</a>
|
||||
<a href="{{ url_for('strategy_page') }}">策略交易</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>实时持仓</h2>
|
||||
<div class="card-body" id="position-live-list">
|
||||
<div class="empty-hint">加载中…</div>
|
||||
<div class="trade-dashboard">
|
||||
<div class="card trade-card" id="order">
|
||||
<h2>期货下单</h2>
|
||||
<div class="card-body">
|
||||
<p class="hint">开仓、加仓由<strong>程序</strong>在「策略交易」中执行,经 CTP 自动报单至 SimNow / 期货公司柜台。</p>
|
||||
<div class="trade-order-status">
|
||||
<div class="status-row">
|
||||
<span class="text-muted">计仓模式</span>
|
||||
<strong>{{ sizing_mode_label }}</strong>
|
||||
{% if sizing_mode == 'risk' %}
|
||||
<span class="text-muted">· 单笔风险 {{ risk_percent }}%</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="status-row">
|
||||
<span class="text-muted">风控状态</span>
|
||||
<strong class="{% if risk_status.can_trade %}text-profit{% else %}text-loss{% endif %}">{{ risk_status.status_label }}</strong>
|
||||
</div>
|
||||
<div class="status-row">
|
||||
<span class="text-muted">程序监控</span>
|
||||
<strong>{{ monitor_count }}</strong> 笔
|
||||
{% if roll_count %}<span class="text-muted">· 滚仓组 {{ roll_count }}</span>{% endif %}
|
||||
</div>
|
||||
{% if active_trend %}
|
||||
<div class="status-row trend-active">
|
||||
<span class="text-muted">趋势回调</span>
|
||||
<strong>#{{ active_trend.id }} {{ active_trend.symbol }} {{ '多' if active_trend.direction=='long' else '空' }}</strong>
|
||||
<span class="text-muted">已开 {{ active_trend.lots_open or 0 }}/{{ active_trend.target_lots }} 手</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if not ctp_status.connected %}
|
||||
<p class="hint text-accent" style="margin-top:.75rem">请先连接 CTP,程序报单才会进入柜台。</p>
|
||||
{% endif %}
|
||||
{% if ctp_status.last_error %}
|
||||
<p class="text-loss" style="font-size:.78rem;margin-top:.5rem">{{ ctp_status.last_error }}</p>
|
||||
{% endif %}
|
||||
<div class="trade-order-actions">
|
||||
<a href="{{ url_for('strategy_page') }}" class="btn-primary">前往策略交易</a>
|
||||
<a href="{{ url_for('strategy_records_page') }}" class="text-muted" style="font-size:.82rem">策略记录 →</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="trade-footer" id="trade-footer">
|
||||
<p class="hint">开仓请使用「策略交易」;连接 CTP 后自动同步 SimNow / 柜台持仓与程序监控。</p>
|
||||
{% if ctp_status.last_error %}<p class="text-loss" style="font-size:.78rem;margin-top:.5rem">{{ ctp_status.last_error }}</p>{% endif %}
|
||||
|
||||
<div class="card trade-card" id="positions">
|
||||
<h2>持仓监控</h2>
|
||||
<div class="card-body card-scroll" id="position-live-list">
|
||||
<div class="empty-hint">加载中…</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card trade-card" id="recommend">
|
||||
<h2>品种推荐</h2>
|
||||
<div class="card-body">
|
||||
<p class="hint">按当前权益 <strong class="text-accent" id="rec-capital">{{ '%.2f'|format(capital) }}</strong> 元筛选;
|
||||
灰色为保证金不足,优先展示可开 1 手且风险规则较友好的品种。</p>
|
||||
<div class="trade-table-wrap">
|
||||
<table class="trade-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>品种</th><th>交易所</th><th>参考价</th><th>1手保证金</th><th>建议最低资金</th><th>状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in recommend_rows %}
|
||||
<tr class="rec-{{ r.status }}">
|
||||
<td><strong>{{ r.name }}</strong> <span class="text-muted">{{ r.ths }}</span></td>
|
||||
<td>{{ r.exchange }}</td>
|
||||
<td>{% if r.price %}{{ r.price }}{% else %}—{% endif %}</td>
|
||||
<td>{% if r.margin_one_lot %}{{ r.margin_one_lot }}{% else %}—{% endif %}</td>
|
||||
<td>{% if r.min_capital_one_lot %}{{ r.min_capital_one_lot }}{% else %}—{% endif %}</td>
|
||||
<td><span class="badge {% if r.status=='ok' %}profit{% elif r.status=='blocked' %}loss{% else %}planned{% endif %}">{{ r.status_label }}</span></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user