Show 永期/期期 in control monitor mode column.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -287,6 +287,21 @@ async def fleet_status(_tok: Annotated[str, Depends(require_fleet_token)]) -> di
|
||||
"martingale_enabled": st.get("martingale_enabled"),
|
||||
"martingale_doubles": st.get("martingale_doubles"),
|
||||
"risk_effective_loss_pct": st.get("risk_effective_loss_pct"),
|
||||
"hedge_mode": (
|
||||
hm
|
||||
if (
|
||||
hm := str(
|
||||
st.get("hedge_mode")
|
||||
or db.get_setting("hedge_mode", settings.hedge_mode)
|
||||
or settings.hedge_mode
|
||||
or "perp_option"
|
||||
)
|
||||
.strip()
|
||||
.lower()
|
||||
)
|
||||
in ("perp_option", "option_option")
|
||||
else "perp_option"
|
||||
),
|
||||
},
|
||||
"position": {
|
||||
"status": pos.get("status") or ("open" if pos.get("has_position") else "flat"),
|
||||
|
||||
@@ -235,18 +235,27 @@ function riskLines(strat: Record<string, unknown>): RiskLines {
|
||||
};
|
||||
}
|
||||
|
||||
function hedgeModeShort(strat: Record<string, unknown>): string {
|
||||
const hm = String(strat.hedge_mode || "perp_option")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
return hm === "option_option" ? "期期" : "永期";
|
||||
}
|
||||
|
||||
function modeLabel(mode: string, strat: Record<string, unknown>): string {
|
||||
const m = String(mode || "-").toUpperCase();
|
||||
const short = m.includes("LIVE") ? "LIVE" : m.includes("SIM") ? "SIM" : m || "-";
|
||||
// A=以损定仓,B=手动开仓
|
||||
return `${short}/${riskLines(strat).sizingShort}`;
|
||||
// A=以损定仓,B=手动开仓;永期=永续+期权,期期=双期权
|
||||
return `${short}/${riskLines(strat).sizingShort}/${hedgeModeShort(strat)}`;
|
||||
}
|
||||
|
||||
function modeLabelTitle(mode: string, strat: Record<string, unknown>): string {
|
||||
const label = modeLabel(mode, strat);
|
||||
const riskBased =
|
||||
strat.sizing_mode === "risk_based" || strat.risk_based === true;
|
||||
return `${label}(${riskBased ? "A=以损定仓" : "B=手动开仓"})`;
|
||||
const hedge =
|
||||
hedgeModeShort(strat) === "期期" ? "期期=双期权对冲" : "永期=永续+期权";
|
||||
return `${label}(${riskBased ? "A=以损定仓" : "B=手动开仓"};${hedge})`;
|
||||
}
|
||||
|
||||
function tokenDotClass(n: {
|
||||
@@ -983,7 +992,8 @@ export default function MonitorPage() {
|
||||
{detailRunning ? "运行中" : "已停"} · {detail.phase}
|
||||
</td>
|
||||
<td>
|
||||
{detail.mode} / {detail.exchange}
|
||||
{modeLabel(detail.mode, detail.strat)} /{" "}
|
||||
{detail.exchange}
|
||||
</td>
|
||||
<td>{detail.rounds ?? "—"}</td>
|
||||
<td className="mono">
|
||||
|
||||
Reference in New Issue
Block a user