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();
|
||||
|
||||
Reference in New Issue
Block a user