Add index-over-ask leverage column to options chain list.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3138,6 +3138,15 @@ html[data-theme="light"] .settings-side-export-label {
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.opt-chain-lev {
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
font-weight: 600;
|
||||
color: #b8c8ff;
|
||||
}
|
||||
html[data-theme="light"] .opt-chain-lev {
|
||||
color: #1a4a8a;
|
||||
}
|
||||
.opt-be-dist-up {
|
||||
color: #5ee89a;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
}
|
||||
|
||||
function strikeTableColspan() {
|
||||
return state.chainView === "t" ? 9 : 8;
|
||||
return 9;
|
||||
}
|
||||
|
||||
function syncChainViewUI() {
|
||||
@@ -817,6 +817,20 @@
|
||||
return "约 " + Number(v).toFixed(1) + "×";
|
||||
}
|
||||
|
||||
/** 链上展示:指数 ÷ 卖一(每1币). */
|
||||
function calcAskLeverage(indexPx, askPx) {
|
||||
if (indexPx == null || askPx == null) return null;
|
||||
const idx = Number(indexPx);
|
||||
const ask = Number(askPx);
|
||||
if (!Number.isFinite(idx) || !Number.isFinite(ask) || ask <= 0) return null;
|
||||
return Math.round((idx / ask) * 10) / 10;
|
||||
}
|
||||
|
||||
function fmtChainLeverage(v) {
|
||||
if (v === null || v === undefined || Number.isNaN(Number(v))) return "—";
|
||||
return Number(v).toFixed(1) + "×";
|
||||
}
|
||||
|
||||
function fmtUsdcSigned(v) {
|
||||
if (v === null || v === undefined || Number.isNaN(Number(v))) return "—";
|
||||
const n = Number(v);
|
||||
@@ -946,16 +960,19 @@
|
||||
return;
|
||||
}
|
||||
let matchedSelected = false;
|
||||
const indexPx = state.chain && state.chain.index_px;
|
||||
list.forEach(function (c) {
|
||||
const tr = document.createElement("tr");
|
||||
tr.className = "opt-strike-row";
|
||||
tr.setAttribute("data-inst", c.inst_id);
|
||||
if (c.moneyness) tr.classList.add("opt-row-" + c.moneyness);
|
||||
const chainLev = calcAskLeverage(indexPx, c.ask);
|
||||
tr.innerHTML =
|
||||
"<td>" + c.strike + "</td>" +
|
||||
"<td>" + moneynessBadge(c) + "</td>" +
|
||||
"<td><code>" + c.inst_id + "</code></td>" +
|
||||
"<td class=\"opt-px-sz\">" + fmtPxSz(c.ask, c.ask_sz, c.ask_estimated) + "</td>" +
|
||||
'<td class="opt-chain-lev">' + fmtChainLeverage(chainLev) + "</td>" +
|
||||
"<td class=\"opt-px-sz\">" + fmtPxSz(c.bid, c.bid_sz) + "</td>" +
|
||||
"<td>" + (c.expiry_be_px != null ? fmt(c.expiry_be_px, 0) : "—") + "</td>" +
|
||||
'<td class="' + distBeClass(c.dist_expiry_be) + '">' + fmtDist(c.dist_expiry_be) + "</td>" +
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
|
||||
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
|
||||
<link rel="stylesheet" href="/static/instance_page.css?v=13">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=110">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=111">
|
||||
<script src="/static/account_risk_badge.js?v=4"></script>
|
||||
<meta name="theme-color" content="#0b0d14">
|
||||
<title>{{ pwa_app_name }}</title>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<link rel="manifest" href="/static/icons/manifest.webmanifest">
|
||||
<title>{{ pwa_app_name }}</title>
|
||||
<link rel="stylesheet" href="/static/instance_page.css?v=13">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=110">
|
||||
<link rel="stylesheet" href="/static/instance_theme.css?v=111">
|
||||
|
||||
</head>
|
||||
<body
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<th>类型</th>
|
||||
<th>合约</th>
|
||||
<th>卖一/张</th>
|
||||
<th title="指数÷卖一(每1币)">杠杆</th>
|
||||
<th>买一/张</th>
|
||||
<th>到期平衡</th>
|
||||
<th>距平衡</th>
|
||||
@@ -80,7 +81,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="opt-strike-tbody">
|
||||
<tr><td colspan="8" class="muted">请选择到期日</td></tr>
|
||||
<tr><td colspan="9" class="muted">请选择到期日</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -323,4 +324,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/options_expiry_countdown.js?v=1"></script>
|
||||
<script src="/static/options_panel.js?v=50"></script>
|
||||
<script src="/static/options_panel.js?v=51"></script>
|
||||
|
||||
Reference in New Issue
Block a user