Filter semi ladder to 2 OTM/ITM or 1 ATM by moneyness selection.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 14:18:03 +08:00
parent 58c12aa160
commit ebd88718a7
+90 -43
View File
@@ -915,49 +915,96 @@ export default function PlanPage() {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{(ladder.rows || []).map((r) => { {(() => {
const tagZh = const all = ladder.rows || [];
r.tag === "atm" let shown = all;
? "平值" if (semiMny === "atm") {
: r.tag === "itm" shown = all.filter((r) => r.tag === "atm").slice(0, 1);
? "实值" } else if (semiMny === "otm") {
: "虚值"; shown = all
const hi = .filter(
(semiMny === "otm" && (r) =>
r.tag === "otm" && r.tag === "otm" &&
Math.abs(r.offset) <= Number(semiOtmOff) + 1e-9) || Math.abs(r.offset) <=
(semiMny === "atm" && r.tag === "atm") || Number(semiOtmOff) + 1e-9,
(semiMny === "itm" && )
(r.tag === "itm" || r.tag === "atm")); .sort(
return ( (a, b) =>
<tr Math.abs(a.offset) - Math.abs(b.offset),
key={r.strike} )
className={ .slice(0, 2);
r.tag === "atm" // Call:虚值高行权在上;Put:虚值低行权在上
? "plan-t-atm" shown.sort((a, b) =>
: hi semiView === "short"
? "plan-t-pick" ? a.strike - b.strike
: undefined : b.strike - a.strike,
} );
> } else {
<td className="mono plan-t-k"> // 实值:最接近现价的 2 档
{Math.round(r.strike)} shown = all
<span className="meta"> .filter((r) => r.tag === "itm")
{" "} .sort(
({r.offset >= 0 ? "+" : ""} (a, b) =>
{fmt(r.offset, 0)}) Math.abs(a.offset) - Math.abs(b.offset),
</span> )
</td> .slice(0, 2);
<td>{tagZh}</td> shown.sort((a, b) =>
<td className="mono"> semiView === "short"
{fmtTopEx("option", r.ask, r.ask_sz)} ? a.strike - b.strike
</td> : b.strike - a.strike,
<td className="mono"> );
{r.lev != null ? `${r.lev.toFixed(0)}x` : "—"} }
</td> if (shown.length === 0) {
</tr> return (
); <tr>
})} <td colSpan={4} className="meta">
{semiMny === "itm"
? "实值"
: semiMny === "atm"
? "平值"
: "虚值"}
{semiMny === "otm"
? `(偏离≤${fmt(semiOtmOff, 0)}`
: ""}
</td>
</tr>
);
}
return shown.map((r) => {
const tagZh =
r.tag === "atm"
? "平值"
: r.tag === "itm"
? "实值"
: "虚值";
return (
<tr
key={r.strike}
className={
r.tag === "atm" ? "plan-t-atm" : "plan-t-pick"
}
>
<td className="mono plan-t-k">
{Math.round(r.strike)}
<span className="meta">
{" "}
({r.offset >= 0 ? "+" : ""}
{fmt(r.offset, 0)})
</span>
</td>
<td>{tagZh}</td>
<td className="mono">
{fmtTopEx("option", r.ask, r.ask_sz)}
</td>
<td className="mono">
{r.lev != null ? `${r.lev.toFixed(0)}x` : "—"}
</td>
</tr>
);
});
})()}
</tbody> </tbody>
</table> </table>
</div> </div>