Files
dekun a1abe159fa Initial standalone crypto_okx with one-click deploy.
Add deploy/manage.sh bootstrap for git.bz121.com/dekun/crypto_okx and point docs at this repo.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 20:00:59 +08:00

56 lines
1.6 KiB
JavaScript

/**
* 实盘下单监控:开仓按钮灰显 + 旁注(强制清仓/冷静期/日冻结等).
*/
(function (global) {
function apply(data) {
const d = data || {};
const btn =
document.getElementById("om-submit-btn") ||
document.querySelector("#add-order-form button.om-submit");
const noteEl = document.getElementById("om-open-block-note");
if (!btn && !noteEl) return;
const canTrade = d.can_trade !== false;
let note = (d.open_block_note || "").trim();
const fc = d.force_close || {};
const rs = d.risk_status || {};
if (!note && fc.enabled && fc.executing) {
const grace = fc.grace_minutes != null ? fc.grace_minutes : 5;
note =
"强制清仓窗口内(北京时间 " +
(fc.hour_label || "--:--") +
" 起 " +
grace +
" 分钟),暂不可开仓";
}
if (!note && rs.can_trade === false && rs.reason) {
note = String(rs.reason);
}
if (!note && !canTrade) {
note = "当前不可开仓";
}
if (btn) {
btn.disabled = !canTrade;
btn.classList.toggle("is-blocked", !canTrade);
btn.setAttribute("aria-disabled", canTrade ? "false" : "true");
if (!canTrade) {
btn.title = note || "当前不可开仓";
} else {
btn.removeAttribute("title");
}
}
if (noteEl) {
if (!canTrade && note) {
noteEl.hidden = false;
noteEl.textContent = note;
} else {
noteEl.hidden = true;
noteEl.textContent = "";
}
}
}
global.OpenSubmitGate = { apply: apply };
})(window);