划转默认折叠,修复币本位到期平衡计算

币本位权利金为币报价,到期平衡按 OKX 结算公式 K/(1±p) 计算;链/持仓/跨式平衡带同步修正。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-23 08:15:33 +08:00
parent aa14688a7e
commit 57cca5554e
5 changed files with 103 additions and 13 deletions
+14 -5
View File
@@ -878,12 +878,21 @@
return Math.round((c + p) * 10000) / 10000;
}
function formatStraddleBand(strike, combinedAsk) {
const per = combinedAsk;
if (strike == null || per == null) return "—";
function formatStraddleBand(strike, combinedAsk, callAsk, putAsk) {
const k = Number(strike);
if (!Number.isFinite(k)) return "—";
if (isCoinMarginMode()) {
const pc = Number(callAsk);
const pp = Number(putAsk);
if (!Number.isFinite(pc) || !Number.isFinite(pp) || pc <= 0 || pp <= 0 || pc >= 1) return "—";
const lo = Math.round((k / (1 + pp)) * 10) / 10;
const hi = Math.round((k / (1 - pc)) * 10) / 10;
return lo.toFixed(0) + " ~ " + hi.toFixed(0);
}
const per = combinedAsk;
if (per == null) return "—";
const d = Number(per);
if (!Number.isFinite(k) || !Number.isFinite(d)) return "—";
if (!Number.isFinite(d)) return "—";
const lo = Math.round((k - d) * 10) / 10;
const hi = Math.round((k + d) * 10) / 10;
return lo.toFixed(0) + " ~ " + hi.toFixed(0);
@@ -1577,7 +1586,7 @@
'<td class="opt-t-call opt-row-actions">' + pickBtnHtml(call && call.inst_id) + "</td>" +
'<td class="opt-t-mid opt-t-strike"><strong>' + row.strike + "</strong></td>" +
'<td class="opt-t-mid opt-t-straddle-prem">' + formatStraddlePremiumCell(call && call.ask, put && put.ask) + "</td>" +
'<td class="opt-t-mid opt-t-straddle-band">' + formatStraddleBand(row.strike, combined) + "</td>" +
'<td class="opt-t-mid opt-t-straddle-band">' + formatStraddleBand(row.strike, combined, call && call.ask, put && put.ask) + "</td>" +
'<td class="opt-t-put">' + (put ? moneynessBadge(put) : "—") + "</td>" +
'<td class="opt-t-put opt-px-sz">' + (put ? fmtPxSz(put.ask, put.ask_sz, put.ask_estimated) : "—") + "</td>" +
'<td class="opt-t-put opt-row-actions">' + pickBtnHtml(put && put.inst_id) + "</td>";