Track open orders as pending until CTP fill, with cancel and timeout.
Add configurable pending timeout in settings and clearer CTP password save feedback. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+32
-4
@@ -118,10 +118,15 @@
|
||||
<label>移动保本缓冲(最小变动价位倍数)</label>
|
||||
<input name="trailing_be_tick_buffer" type="number" step="1" min="1" max="20" value="{{ trailing_be_tick_buffer }}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>开仓挂单超时(分钟)</label>
|
||||
<input name="pending_order_timeout_min" type="number" step="1" min="1" max="60" value="{{ pending_order_timeout_min }}">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary" style="margin-top:.75rem">保存交易设置</button>
|
||||
<p class="hint" style="margin-top:.75rem;margin-bottom:0">
|
||||
保证金上限用于开仓校验与品种最大手数估算(默认 30%)。<strong>移动保本</strong>:达 1R 后止损移至开仓价 ± N 跳。CTP 账号与前置在下方「CTP 连接」中配置。
|
||||
保证金上限用于开仓校验与品种最大手数估算(默认 30%)。<strong>移动保本</strong>:达 1R 后止损移至开仓价 ± N 跳。
|
||||
<strong>挂单超时</strong>:限价开仓未成交时,超过设定分钟数自动向柜台撤单(1~60 分钟)。CTP 账号与前置在下方「CTP 连接」中配置。
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
@@ -161,8 +166,12 @@
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>交易密码</label>
|
||||
<input name="simnow_password" type="password" autocomplete="new-password"
|
||||
placeholder="{% if ctp_cfg.simnow_password_set %}已设置,留空不修改{% else %}SimNow 密码{% endif %}">
|
||||
<input id="simnow_password" name="simnow_password" type="password"
|
||||
autocomplete="off" spellcheck="false"
|
||||
placeholder="{% if ctp_cfg.simnow_password_set %}已设置:须重新输入才会更新{% else %}SimNow 交易密码(必填){% endif %}">
|
||||
<p class="hint" style="margin:.25rem 0 0;font-size:.75rem">
|
||||
与快期相同密码,保存前须在此<strong>手打</strong>;留空则不改。下方「修改密码」是网页登录密码,不是 SimNow。
|
||||
</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>经纪商代码</label>
|
||||
@@ -249,7 +258,8 @@
|
||||
<button type="submit" class="btn-primary">保存 CTP 配置</button>
|
||||
<p class="settings-ctp-status">
|
||||
官方第一套:<code>180.168.146.187:10201/10211</code>;
|
||||
7×24:<code>182.254.243.31:40001/40011</code>(新账号可能需满 3 个交易日)。
|
||||
第二套(云服务器常用):<code>182.254.243.31:30001/30011</code>;
|
||||
7×24:<code>182.254.243.31:40001/40011</code>(部分账号在 40001 会报「不合法登录」,与快期前置保持一致)。
|
||||
详见 <code>docs/SIMNOW.md</code>。
|
||||
</p>
|
||||
</form>
|
||||
@@ -373,6 +383,24 @@
|
||||
});
|
||||
});
|
||||
loadCtpFoldState();
|
||||
|
||||
var ctpForm = document.getElementById('ctp-settings-form');
|
||||
if (ctpForm) {
|
||||
ctpForm.addEventListener('submit', function (ev) {
|
||||
var simnowFold = document.querySelector('[data-ctp-fold="simnow"]');
|
||||
if (simnowFold) setCtpFold(simnowFold, false);
|
||||
var pwd = document.getElementById('simnow_password');
|
||||
var pwdVal = pwd && pwd.value ? pwd.value.trim() : '';
|
||||
var pwdWasSet = {{ 'true' if ctp_cfg.simnow_password_set else 'false' }};
|
||||
if (pwdWasSet && !pwdVal) {
|
||||
var ok = window.confirm(
|
||||
'SimNow 交易密码为空,保存后不会更新密码(仍用旧密码)。\n\n'
|
||||
+ '若快期已改密,请取消后在「交易密码」框手打新密码再保存。\n\n仍要保存其他项?'
|
||||
);
|
||||
if (!ok) ev.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
<div class="card trade-card" id="positions">
|
||||
<h2>持仓监控</h2>
|
||||
<p class="hint pos-hint">开仓后立即写入本地监控并显示;后台每秒同步 CTP 柜台更新盈亏与手数。刷新页面优先读本地缓存。</p>
|
||||
<p class="hint pos-hint">开仓委托先显示「挂单中」,柜台成交后写入监控;超过 <strong>{{ pending_order_timeout_min }}</strong> 分钟未成交自动撤单,可手动撤单。</p>
|
||||
<div class="card-body card-scroll" id="position-live-list">
|
||||
<div class="empty-hint" id="position-placeholder">加载本地持仓…</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user