Show min option hours in control risk/open column.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-03 07:56:32 +08:00
parent 44a545e6e4
commit b09bcd8414
2 changed files with 10 additions and 3 deletions
+3
View File
@@ -271,6 +271,9 @@ async def fleet_status(_tok: Annotated[str, Depends(require_fleet_token)]) -> di
"min_option_leverage": _pick( "min_option_leverage": _pick(
"min_option_leverage", float(settings.min_option_leverage) "min_option_leverage", float(settings.min_option_leverage)
), ),
"min_option_hours": _pick(
"min_option_hours", float(settings.min_option_hours)
),
"perp_margin_mode": st.get("perp_margin_mode"), "perp_margin_mode": st.get("perp_margin_mode"),
"perp_qty_eth": st.get("perp_qty_eth"), "perp_qty_eth": st.get("perp_qty_eth"),
"option_qty_eth": st.get("option_qty_eth"), "option_qty_eth": st.get("option_qty_eth"),
+7 -3
View File
@@ -180,8 +180,9 @@ type RiskLines = {
lossPct: string | null; lossPct: string | null;
exit: string; exit: string;
openRatio: string | null; openRatio: string | null;
/** 表格「风险/开仓」列:如 5%/1:2;手动为 —/名义比 */ /** 表格「风险/开仓」列:如 5%/1:2/12;手动为 —/名义比/时长 */
riskOrOpen: string; riskOrOpen: string;
minHours: string;
leverage: string; leverage: string;
}; };
@@ -218,7 +219,9 @@ function riskLines(strat: Record<string, unknown>): RiskLines {
const openRatio = riskBased const openRatio = riskBased
? `${unitLabel(strat.risk_perp_unit)}:${unitLabel(strat.risk_option_unit)}` ? `${unitLabel(strat.risk_perp_unit)}:${unitLabel(strat.risk_option_unit)}`
: `${unitLabel(strat.perp_qty_eth)}:${unitLabel(strat.option_qty_eth)}`; : `${unitLabel(strat.perp_qty_eth)}:${unitLabel(strat.option_qty_eth)}`;
const riskOrOpen = `${lossPct || "—"}/${openRatio}`; const hoursN = Number(strat.min_option_hours);
const minHours = Number.isFinite(hoursN) ? unitLabel(hoursN) : "—";
const riskOrOpen = `${lossPct || "—"}/${openRatio}/${minHours}`;
return { return {
riskBased, riskBased,
sizing: riskBased ? "以损定仓(A)" : "手动开仓(B)", sizing: riskBased ? "以损定仓(A)" : "手动开仓(B)",
@@ -227,6 +230,7 @@ function riskLines(strat: Record<string, unknown>): RiskLines {
exit, exit,
openRatio, openRatio,
riskOrOpen, riskOrOpen,
minHours,
leverage: leveragePair(strat), leverage: leveragePair(strat),
}; };
} }
@@ -789,7 +793,7 @@ export default function MonitorPage() {
<td className="mono">{s.rounds ?? "—"}</td> <td className="mono">{s.rounds ?? "—"}</td>
<td <td
className="mono" className="mono"
title="风险比例 / 开仓比例" title="风险比例 / 开仓比例 / 最小剩余时长(h)"
> >
{risk.riskOrOpen} {risk.riskOrOpen}
</td> </td>