fix(hedge): do not apply option leverage gate to ITM/ATM chain list
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -149,6 +149,18 @@
|
||||
return fmt(v, 2) + ":1";
|
||||
}
|
||||
|
||||
function optionPrimaryLevOk(c, moneyKind) {
|
||||
const idx = indexPx();
|
||||
const ask = Number(c && c.ask);
|
||||
if (!(idx > 0) || !(ask > 0)) return true;
|
||||
const kind = moneyKind || opMoneyKind();
|
||||
// 方案:杠杆门主要卡虚值;实/平列表不过滤,选用/启动再校验
|
||||
if (kind !== "otm") return true;
|
||||
const minLev = numInput("hp-opt-leverage", 200);
|
||||
const levFloor = Math.max(minLev, 180);
|
||||
return idx / ask >= levFloor;
|
||||
}
|
||||
|
||||
function matchesMoneyFilter(c) {
|
||||
const f = state.moneyFilter || "itm";
|
||||
const m = (c.moneyness || "").toLowerCase();
|
||||
@@ -159,10 +171,9 @@
|
||||
if (idx && interval > 0 && Math.abs(Number(c.strike) - idx) > interval + 1e-9) {
|
||||
return false;
|
||||
}
|
||||
const ask = Number(c.ask || 0);
|
||||
const minLev = numInput("hp-opt-leverage", f === "otm" ? 200 : 100);
|
||||
const levFloor = f === "otm" ? Math.max(minLev, 180) : minLev;
|
||||
if (idx && ask > 0 && levFloor > 0 && idx / ask < levFloor) return false;
|
||||
if (!optionPrimaryLevOk(c, f === "otm" ? "otm" : f === "atm" ? "atm" : "itm")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (f === "itm") return m === "itm" || m === "atm";
|
||||
if (f === "atm") return m === "atm";
|
||||
@@ -1122,11 +1133,32 @@
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="muted">请选择到期日</td></tr>';
|
||||
return;
|
||||
}
|
||||
const list = (exp.contracts || []).filter(function (c) {
|
||||
return String(c.opt_type || "").toUpperCase() === want && matchesMoneyFilter(c);
|
||||
const sameType = (exp.contracts || []).filter(function (c) {
|
||||
return String(c.opt_type || "").toUpperCase() === want;
|
||||
});
|
||||
const list = sameType.filter(matchesMoneyFilter);
|
||||
if (!list.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="muted">无匹配合约</td></tr>';
|
||||
const idx = indexPx();
|
||||
const interval = isOptionPrimary() ? numInput("hp-strike-interval", 15) : null;
|
||||
let hint = "无匹配合约";
|
||||
if (isOptionPrimary() && sameType.length) {
|
||||
hint =
|
||||
"无匹配" +
|
||||
(want === "C" ? "Call" : "Put") +
|
||||
"(已滤 " +
|
||||
sameType.length +
|
||||
" 档)·检查间隔" +
|
||||
(interval != null ? "≤" + interval : "") +
|
||||
"点/虚实值" +
|
||||
(state.moneyFilter === "otm" ? "/虚值杠杆门" : "");
|
||||
} else if (!sameType.length) {
|
||||
hint =
|
||||
"该到期无 " +
|
||||
(want === "C" ? "Call" : "Put") +
|
||||
(idx ? " · 指数 " + fmt(idx, 2) : "") +
|
||||
" · 可换到期或点刷新链";
|
||||
}
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="muted">' + hint + "</td></tr>";
|
||||
return;
|
||||
}
|
||||
list.forEach(function (c) {
|
||||
|
||||
@@ -368,4 +368,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/hedge_plan.js?v=39"></script>
|
||||
<script src="/static/hedge_plan.js?v=40"></script>
|
||||
|
||||
Reference in New Issue
Block a user