Sync CTP monitors on strategy page load for roll trading.
Revive and sync active monitors from live positions before listing roll candidates, show ineligible monitors with reasons, and validate eligibility on preview. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -106,6 +106,10 @@
|
||||
<p class="hint text-muted">当前为「{{ sizing_mode_label }}」模式,滚仓不可用。请在系统设置切换为<strong>固定金额</strong>。</p>
|
||||
{% endif %}
|
||||
{% if monitors %}
|
||||
{% set roll_eligible_count = monitors|selectattr('roll_eligible')|list|length %}
|
||||
{% if roll_eligible_count == 0 %}
|
||||
<p class="hint text-muted">检测到 {{ monitors|length }} 条持仓监控,但当前均不可滚仓(见下拉项说明)。</p>
|
||||
{% endif %}
|
||||
<p class="hint" id="roll-risk-hint">风险预算(固定金额):<strong id="roll-risk-budget">{{ '%.0f'|format(fixed_amount) }} 元</strong></p>
|
||||
<form id="roll-form" class="form-compact">
|
||||
<div class="form-line line-2">
|
||||
@@ -114,8 +118,7 @@
|
||||
<option value="{{ m.id }}"
|
||||
data-direction="{{ m.direction }}"
|
||||
data-eligible="{{ '1' if m.roll_eligible else '0' }}"
|
||||
data-block="{{ m.roll_block_reason or '' }}"
|
||||
{% if not m.roll_eligible %}disabled{% endif %}>
|
||||
data-block="{{ m.roll_block_reason or '' }}">
|
||||
{{ m.symbol_name or m.symbol }} {{ m.symbol }} · {{ '多' if m.direction == 'long' else '空' }} #{{ m.id }}
|
||||
· {{ m.lots }}手 · SL {{ m.stop_loss or '—' }}
|
||||
{% if not m.roll_eligible %} · {{ m.roll_block_reason }}{% endif %}
|
||||
@@ -145,6 +148,7 @@
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="empty-hint">暂无可用持仓监控</p>
|
||||
<p class="hint text-muted" style="font-size:.78rem">若「委托与持仓」中已有持仓,请先在持仓页连接 CTP 并刷新,再回到本页。</p>
|
||||
<ol class="strategy-steps">
|
||||
<li>打开 <a href="{{ url_for('positions') }}">持仓监控</a>,连接 CTP</li>
|
||||
<li>系统设置为<strong>固定金额</strong>,在「期货下单」开仓(勿开移动保本)</li>
|
||||
|
||||
Reference in New Issue
Block a user