fix(hedge): filter options-chain by min hours and strike interval for option-primary

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-09 08:38:11 +08:00
parent afe361ce47
commit e7e733d9a9
5 changed files with 74 additions and 5 deletions
+10 -3
View File
@@ -1036,9 +1036,16 @@
}
async function loadChain() {
const d = await apiJson(
"/api/hedge-plan/options-chain?underlying=" + encodeURIComponent(state.underlying)
);
let url =
"/api/hedge-plan/options-chain?underlying=" + encodeURIComponent(state.underlying);
if (isOptionPrimary()) {
url +=
"&option_primary=1&min_hours=" +
encodeURIComponent(String(numInput("hp-min-hours", 36))) +
"&strike_interval=" +
encodeURIComponent(String(numInput("hp-strike-interval", 15)));
}
const d = await apiJson(url);
state.chain = d;
const idx = $("hp-index-line");
if (idx) idx.textContent = "指数 " + fmt(d.index_px, 2);