Fix roll first-lots display and make market add use pending orders.
Store initial_lots on roll groups, submit market roll as CTP pending legs with cancel closing empty groups, and backfill first-lots for existing active groups. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
}
|
||||
if (execHint) execHint.hidden = false;
|
||||
if (btnExec) {
|
||||
btnExec.textContent = mode === 'market' ? '执行滚仓' : '提交监控';
|
||||
btnExec.textContent = mode === 'market' ? '提交委托' : '提交监控';
|
||||
}
|
||||
if (btnPreview) {
|
||||
btnPreview.disabled = false;
|
||||
@@ -257,21 +257,22 @@
|
||||
btnRollE.addEventListener('click', function () {
|
||||
var payload = rollPayload || formData(rollForm);
|
||||
var mode = (payload.add_mode || 'market');
|
||||
if (mode === 'market') {
|
||||
if (!inTradingSession) {
|
||||
alert('休盘期间请切换为「突破加仓」后提交监控');
|
||||
return;
|
||||
}
|
||||
if (!confirm('确认执行市价滚仓?')) return;
|
||||
startRollCountdown(btnRollE, payload);
|
||||
if (mode === 'market' && !inTradingSession) {
|
||||
alert('休盘期间请切换为「突破加仓」后提交监控');
|
||||
return;
|
||||
}
|
||||
var confirmMsg = mode === 'market'
|
||||
? '确认提交市价加仓委托?可在「正在滚仓」中撤单。'
|
||||
: '确认提交突破加仓监控?';
|
||||
if (!confirm(confirmMsg)) return;
|
||||
btnRollE.disabled = true;
|
||||
btnRollE.textContent = '提交中…';
|
||||
jsonPost('/api/strategy/roll/execute', payload).then(function (d) {
|
||||
if (!d.ok) { alert(d.error || '失败'); return; }
|
||||
alert(d.message || '已提交监控');
|
||||
alert(d.message || (mode === 'market' ? '委托已提交' : '已提交监控'));
|
||||
location.reload();
|
||||
}).catch(function () {
|
||||
alert('提交失败,请稍后重试');
|
||||
}).finally(function () {
|
||||
btnRollE.disabled = false;
|
||||
syncRollModeUi();
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
<button type="button" class="btn-primary" id="btn-roll-exec" hidden {% if not roll_allowed %}disabled{% endif %}>执行滚仓</button>
|
||||
</div>
|
||||
<div id="roll-preview" class="strategy-preview" hidden></div>
|
||||
<p class="hint" id="roll-exec-hint" hidden style="font-size:.75rem;margin-top:.45rem">市价加仓:须交易时段内确认,10 秒倒计时执行;突破加仓:休盘也可提交,开盘后再监控触价</p>
|
||||
<p class="hint" id="roll-exec-hint" hidden style="font-size:.75rem;margin-top:.45rem">市价加仓:提交后进入「正在滚仓」挂单,成交后更新持仓;撤单后滚仓组消失。突破加仓:休盘也可提交,开盘触价后自动市价加仓。</p>
|
||||
{% if not trading_session %}
|
||||
<p class="hint text-muted" id="roll-off-session-hint" style="font-size:.75rem;margin-top:.35rem">当前{{ session_clock.status_label or '休盘' }}:市价加仓须交易时段内执行;休盘可先预览,或选「突破加仓」提交监控。</p>
|
||||
{% else %}
|
||||
|
||||
Reference in New Issue
Block a user