修复 OKX 期权翻倍出场与币本位浮盈:中控/看板按指数折 U,避免 BTC 币数量当美金。
翻倍出场按全仓买一判定且对冲表异常不再整段跳过;面板按当前倍数展示需回收公式。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1977,6 +1977,21 @@
|
||||
return fmt(n, 2) + "倍";
|
||||
}
|
||||
|
||||
function profitExitHint(mult, req, premCcy) {
|
||||
const n = Number(mult);
|
||||
const m = Number.isFinite(n) && n > 0 ? n : 1;
|
||||
const needFactor = 1 + m;
|
||||
const factorTxt = Math.abs(needFactor - Math.round(needFactor)) < 1e-9
|
||||
? String(Math.round(needFactor))
|
||||
: fmt(needFactor, 2);
|
||||
let hint = formatProfitExitMultLabel(m) + "=盈利达权利金×" + fmt(m, 2)
|
||||
+ " → 需回收≥权利金×" + factorTxt;
|
||||
if (req != null) {
|
||||
hint += " · 即≥" + fmtPremiumAmt(req, premCcy) + " " + premCcy;
|
||||
}
|
||||
return hint;
|
||||
}
|
||||
|
||||
function renderProfitExitRow(p) {
|
||||
const inst = p.inst_id || "";
|
||||
if (p.hedge_plan_target) {
|
||||
@@ -1997,6 +2012,7 @@
|
||||
const statePe = String(p.profit_exit_state || (enabled ? "active" : "idle"));
|
||||
const req = p.profit_exit_required_recycle;
|
||||
const premCcy = posPremiumCcy(p);
|
||||
const hintMult = Number.isFinite(multNum) && multNum > 0 ? multNum : serverMult;
|
||||
let statusTxt = enabled ? ("监控中 · " + multLabel) : "未开启";
|
||||
if (enabled && statePe === "closing") statusTxt = "平仓挂单中 · " + multLabel;
|
||||
return (
|
||||
@@ -2013,7 +2029,7 @@
|
||||
'<span class="opt-target-armed">' + statusTxt + "</span>" +
|
||||
'<span class="muted opt-target-row-hint">' +
|
||||
(enabled
|
||||
? ("1倍=盈利=权利金" + (req != null ? (" · 需回收≥" + fmtPremiumAmt(req, premCcy) + " " + premCcy) : ""))
|
||||
? profitExitHint(hintMult, req, premCcy)
|
||||
: "开启后自选倍数;达标按买一限价平;可随时关闭") +
|
||||
"</span>" +
|
||||
"</div>"
|
||||
|
||||
Reference in New Issue
Block a user