Hedge start: re-quote ask and resize OO sheets; add HEDGE_PLAN_BUDGET_BUFFER.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-20 10:09:32 +08:00
parent a43cb35d9a
commit 5b346a5760
8 changed files with 382 additions and 14 deletions
+13 -3
View File
@@ -487,9 +487,9 @@
else if (b.msg) parts.push(b.msg);
line.textContent = parts.join(" · ");
line.title =
"预算=min(交易×" +
"对冲预算=min(交易×" +
fmt(b.buf, 2) +
", 单笔)" +
", 单笔) · 缓冲 HEDGE_PLAN_BUDGET_BUFFER" +
(b.tradingCap != null ? " · 交易×缓冲 " + fmt(b.tradingCap, 2) : "") +
(b.tradeCap != null ? " · 单笔 " + fmt(b.tradeCap, 2) : "");
line.classList.toggle("hp-oo-budget-warn", !!(extra && extra.msg) || !b.ok);
@@ -1692,6 +1692,7 @@
target_price_down: down,
target_price: up,
oo_close_mode: state.ooCloseModeEnabled ? state.ooCloseMode : "hold_expiry",
oo_sheets_mode: state.ooSheetsMode || "same_sheets",
leg_a: legPayload(state.legA, ooSheets("hp-oo-sheets-a")),
leg_b: legPayload(state.legB, ooSheets("hp-oo-sheets-b")),
};
@@ -1731,19 +1732,28 @@
});
setGateLine(d.gates);
closePreviewModal();
const refreshHint =
d.refresh && d.refresh.msg ? "\n" + String(d.refresh.msg) : "";
if (d.partial) {
alert(
(d.msg || "半腿失败,已挂待补") +
(d.plan_id ? "\n计划 #" + d.plan_id : "") +
refreshHint +
"\n请到「进行中的计划」补开缺失腿"
);
state.tab = "active";
syncTabUI();
void loadActivePlans();
} else {
alert("计划已启动 #" + (d.plan_id || "") + (d.dry_run ? " (dry_run)" : ""));
alert(
"计划已启动 #" +
(d.plan_id || "") +
(d.dry_run ? " (dry_run)" : "") +
refreshHint
);
}
void loadGates();
if (isOo) void loadChain();
} catch (e) {
alert(e.message || String(e));
syncPreviewStartBtn();