fix(hub): restore pre-WS quote path and relieve Gate/account contention

Two audit rounds after WS rollback: lighten hub options snapshot, cache hub balances without extra fetch_balance, soft-poll single-flight, and document fixes in R1/R2 reports.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-11 12:30:27 +08:00
parent d592632834
commit bab42b1b53
12 changed files with 209 additions and 39 deletions
+15 -9
View File
@@ -4022,20 +4022,26 @@
function renderOptionsSectionBody(row, opts) {
const options = opts || {};
const layout = options.layout || "table";
const opt = row.options || {};
const caps = Array.isArray(row.capabilities) ? row.capabilities : [];
const wantsOptions = caps.indexOf("options") >= 0;
const opt = row.options;
let html = "";
if (opt.enabled === false) {
html += renderOptionsAccountStatRow(opt);
if (wantsOptions && (opt == null || typeof opt !== "object")) {
html += '<div class="section-title hub-options-title">期权持仓</div>';
html += `<div class="err">期权数据不可用</div>`;
} else if ((opt || {}).enabled === false) {
html += renderOptionsAccountStatRow(opt || {});
html += '<div class="section-title hub-options-title">期权持仓</div>';
html += '<div class="empty-hint">期权未启用(OKX_OPTIONS_ENABLED)</div>';
} else if (opt.ok === false) {
html += renderOptionsAccountStatRow(opt);
} else if ((opt || {}).ok === false) {
html += renderOptionsAccountStatRow(opt || {});
html += '<div class="section-title hub-options-title">期权持仓</div>';
html += `<div class="err">${esc(opt.msg || "期权数据不可用")}</div>`;
html += `<div class="err">${esc((opt && (opt.msg || opt.error)) || "期权数据不可用")}</div>`;
} else {
const pos = Array.isArray(opt.positions) ? opt.positions : [];
const targets = Array.isArray(opt.target_monitors) ? opt.target_monitors : [];
html += renderOptionsAccountStatRow(opt);
const optSafe = opt || {};
const pos = Array.isArray(optSafe.positions) ? optSafe.positions : [];
const targets = Array.isArray(optSafe.target_monitors) ? optSafe.target_monitors : [];
html += renderOptionsAccountStatRow(optSafe);
html += `<div class="section-title hub-options-title">期权持仓 · ${pos.length} 仓</div>`;
html +=
layout === "cards"