From f0b0b91f1bab25dd0b2e366f7dbe67867fcad88d Mon Sep 17 00:00:00 2001
From: dekun
Date: Wed, 29 Jul 2026 23:59:29 +0800
Subject: [PATCH] =?UTF-8?q?Show=20risk=20sizing=20as=20a=20dedicated=20Pla?=
=?UTF-8?q?n=20mode=20row=20(=E6=AF=94=E4=BE=8B=20/=20k=20/=20=E9=A2=84?=
=?UTF-8?q?=E7=AE=97).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Cursor
---
frontend/src/pages/Plan.tsx | 63 ++++++++++++++++++++-------------
frontend/src/pages/Settings.tsx | 2 +-
2 files changed, 39 insertions(+), 26 deletions(-)
diff --git a/frontend/src/pages/Plan.tsx b/frontend/src/pages/Plan.tsx
index 028e117..ae1a308 100644
--- a/frontend/src/pages/Plan.tsx
+++ b/frontend/src/pages/Plan.tsx
@@ -158,11 +158,27 @@ export default function PlanPage() {
const exitRuleLabel =
exitMode === "premium_multiple"
? `权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
- : plan?.risk_based || plan?.sizing_mode === "risk_based"
+ : riskBased
? exitTarget != null
- ? `以损定仓 · 固定 ${fmt(exitTarget)} U(基数${fmt(plan?.risk_exit_unit ?? 15)})`
- : `以损定仓 · 待估算(基数${fmt(plan?.risk_exit_unit ?? 15)})`
+ ? `固定 ${fmt(exitTarget)} U(基数${fmt(plan?.risk_exit_unit ?? 15)})`
+ : `待估算(基数${fmt(plan?.risk_exit_unit ?? 15)})`
: `固定 ${fmt(plan?.net_profit_target ?? 15)} U`;
+ const riskRatioLabel = `比例${Number(plan?.risk_perp_unit ?? 1)}:${Number(plan?.risk_option_unit ?? 2)}`;
+ const sizingModeLabel = riskBased
+ ? [
+ "以损定仓",
+ riskRatioLabel,
+ plan?.risk_last_k != null ? `k=${fmt(plan.risk_last_k, 1)}` : null,
+ plan?.risk_sizing_preview?.budget != null
+ ? `预算${fmt(plan.risk_sizing_preview.budget, 2)}U`
+ : null,
+ plan?.risk_sizing_preview?.ok === false
+ ? String(plan.risk_sizing_preview.detail || "预览失败")
+ : null,
+ ]
+ .filter(Boolean)
+ .join(" ")
+ : "手动仓位";
const phaseLabel = PHASE_ZH[plan?.phase || ""] || plan?.phase || "—";
const atmRule = plan?.fixed_direction_enabled
? plan?.fixed_perp_side === "short"
@@ -246,6 +262,10 @@ export default function PlanPage() {
行情
{String(plan?.exchange || "okx").toUpperCase()} · ETH-USDT-SWAP
+
+ 模式
+ {sizingModeLabel}
+
开仓
永续{" "}
@@ -253,7 +273,11 @@ export default function PlanPage() {
? `${fmt(displayPerpQty, 2)} ETH`
: "—"}{" "}
/ {fmt(plan?.leverage, 0)}x
- · 期权 {fmt(plan?.option_qty_eth ?? 2, 2)} ETH 名义 · 剩余≥
+ · 期权{" "}
+ {displayOptQty != null
+ ? `${fmt(displayOptQty, 2)} ETH`
+ : "—"}{" "}
+ 名义 · 剩余≥
{fmt(plan?.min_option_hours, 0)}h · 期权杠杆≥
{fmt(plan?.min_option_leverage, 0)}x · {atmRule}
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
@@ -357,30 +381,19 @@ export default function PlanPage() {
+
+ 模式
+
+ {riskBased ? (
+ {sizingModeLabel}
+ ) : (
+ sizingModeLabel
+ )}
+
+
选约条件
- {plan?.risk_based || plan?.sizing_mode === "risk_based" ? (
- <>
- 以损定仓
- {" · "}
- 比例{fmt(plan?.risk_perp_unit ?? 1, 2)}:
- {fmt(plan?.risk_option_unit ?? 2, 2)}
- {plan?.risk_last_k
- ? ` · k=${fmt(plan.risk_last_k, 1)}`
- : ""}
- {plan?.risk_sizing_preview?.budget != null
- ? ` · 预算${fmt(plan.risk_sizing_preview.budget, 2)}U`
- : ""}
- {plan?.risk_sizing_preview?.max_loss != null
- ? ` · 估亏${fmt(plan.risk_sizing_preview.max_loss, 2)}U`
- : ""}
- {plan?.risk_sizing_preview?.ok === false
- ? ` · ${String(plan.risk_sizing_preview.detail || "预览失败")}`
- : ""}
- {" · "}
- >
- ) : null}
永续
{displayPerpQty != null
? `${fmt(displayPerpQty, 2)}ETH`
diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx
index 93b1a9b..2bf3f08 100644
--- a/frontend/src/pages/Settings.tsx
+++ b/frontend/src/pages/Settings.tsx
@@ -639,7 +639,7 @@ export default function SettingsPage() {
-
+