Highlight 期期 hedge mode in control monitor with amber.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -242,11 +242,41 @@ function hedgeModeShort(strat: Record<string, unknown>): string {
|
||||
return hm === "option_option" ? "期期" : "永期";
|
||||
}
|
||||
|
||||
function modeLabel(mode: string, strat: Record<string, unknown>): string {
|
||||
function modeParts(
|
||||
mode: string,
|
||||
strat: Record<string, unknown>,
|
||||
): { head: string; hedge: string; isOo: boolean } {
|
||||
const m = String(mode || "-").toUpperCase();
|
||||
const short = m.includes("LIVE") ? "LIVE" : m.includes("SIM") ? "SIM" : m || "-";
|
||||
// A=以损定仓,B=手动开仓;永期=永续+期权,期期=双期权
|
||||
return `${short}/${riskLines(strat).sizingShort}/${hedgeModeShort(strat)}`;
|
||||
const hedge = hedgeModeShort(strat);
|
||||
return {
|
||||
head: `${short}/${riskLines(strat).sizingShort}`,
|
||||
hedge,
|
||||
isOo: hedge === "期期",
|
||||
};
|
||||
}
|
||||
|
||||
function modeLabel(mode: string, strat: Record<string, unknown>): string {
|
||||
const p = modeParts(mode, strat);
|
||||
return `${p.head}/${p.hedge}`;
|
||||
}
|
||||
|
||||
function ModeLabelView({
|
||||
mode,
|
||||
strat,
|
||||
}: {
|
||||
mode: string;
|
||||
strat: Record<string, unknown>;
|
||||
}) {
|
||||
const p = modeParts(mode, strat);
|
||||
return (
|
||||
<>
|
||||
{p.head}/
|
||||
<span className={p.isOo ? "mode-hedge-oo" : "mode-hedge-po"}>
|
||||
{p.hedge}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function modeLabelTitle(mode: string, strat: Record<string, unknown>): string {
|
||||
@@ -793,7 +823,7 @@ export default function MonitorPage() {
|
||||
className="mono"
|
||||
title={modeLabelTitle(s.mode, s.strat)}
|
||||
>
|
||||
{modeLabel(s.mode, s.strat)}
|
||||
<ModeLabelView mode={s.mode} strat={s.strat} />
|
||||
</td>
|
||||
<td className="mono">{s.exchange}</td>
|
||||
<td className={inPos ? "pnl-pos" : "pnl-neg"}>
|
||||
@@ -992,8 +1022,11 @@ export default function MonitorPage() {
|
||||
{detailRunning ? "运行中" : "已停"} · {detail.phase}
|
||||
</td>
|
||||
<td>
|
||||
{modeLabel(detail.mode, detail.strat)} /{" "}
|
||||
{detail.exchange}
|
||||
<ModeLabelView
|
||||
mode={detail.mode}
|
||||
strat={detail.strat}
|
||||
/>{" "}
|
||||
/ {detail.exchange}
|
||||
</td>
|
||||
<td>{detail.rounds ?? "—"}</td>
|
||||
<td className="mono">
|
||||
|
||||
@@ -413,6 +413,17 @@ input {
|
||||
text-shadow: 0 0 8px rgba(0, 200, 255, 0.25);
|
||||
}
|
||||
|
||||
/* 中控模式列:期期高亮,永期保持弱化 */
|
||||
.mode-hedge-oo {
|
||||
color: #ffb020;
|
||||
text-shadow: 0 0 8px rgba(255, 176, 32, 0.45);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mode-hedge-po {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
|
||||
Reference in New Issue
Block a user