Wire manual close to actually flatten option then perp then sell coin.

UI 平仓 now calls /api/hedge-plan/<id>/close instead of end-only (不平仓).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 16:49:24 +08:00
parent b7b1a7e7e0
commit 989accdc50
4 changed files with 304 additions and 8 deletions
+8 -5
View File
@@ -2920,26 +2920,29 @@
async function endActivePlan(planId) {
if (
!window.confirm(
"确认平仓并结束计划 #" +
"确认平仓 #" +
planId +
"?\n未成交/待补腿将取消。\n说明:当前为结束计划标记,交易所持仓请自行确认已平。"
"?\n将按顺序:平期权(须买一流动性)→平永续→卖币回 USDT。\n买一不足时会中止并保留计划。"
)
) {
return;
}
try {
const d = await apiJson("/api/hedge-plan/" + planId + "/end", {
const d = await apiJson("/api/hedge-plan/" + planId + "/close", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({}),
});
alert(d.msg || "计划已结束 #" + (d.plan_id || planId));
alert(d.msg || "已平仓 #" + (d.plan_id || planId));
void loadLivePositions();
void loadActivePlans();
void loadHistory();
void loadGates();
void refreshPoStrategyStatus();
} catch (e) {
alert(e.message || String(e));
void loadLivePositions();
void loadActivePlans();
}
}
@@ -3017,7 +3020,7 @@
'">成交细节</button> ' +
'<button type="button" class="btn-secondary hp-btn-end" data-id="' +
p.id +
'">结束计划</button></td>';
'">平仓</button></td>';
tbody.appendChild(tr);
});
bindActivePlanRowActions(tbody);