Show risk sizing as a dedicated Plan mode row (比例 / k / 预算).
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+38
-25
@@ -158,11 +158,27 @@ export default function PlanPage() {
|
|||||||
const exitRuleLabel =
|
const exitRuleLabel =
|
||||||
exitMode === "premium_multiple"
|
exitMode === "premium_multiple"
|
||||||
? `权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
|
? `权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
|
||||||
: plan?.risk_based || plan?.sizing_mode === "risk_based"
|
: riskBased
|
||||||
? exitTarget != null
|
? exitTarget != null
|
||||||
? `以损定仓 · 固定 ${fmt(exitTarget)} U(基数${fmt(plan?.risk_exit_unit ?? 15)})`
|
? `固定 ${fmt(exitTarget)} U(基数${fmt(plan?.risk_exit_unit ?? 15)})`
|
||||||
: `以损定仓 · 待估算(基数${fmt(plan?.risk_exit_unit ?? 15)})`
|
: `待估算(基数${fmt(plan?.risk_exit_unit ?? 15)})`
|
||||||
: `固定 ${fmt(plan?.net_profit_target ?? 15)} U`;
|
: `固定 ${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 phaseLabel = PHASE_ZH[plan?.phase || ""] || plan?.phase || "—";
|
||||||
const atmRule = plan?.fixed_direction_enabled
|
const atmRule = plan?.fixed_direction_enabled
|
||||||
? plan?.fixed_perp_side === "short"
|
? plan?.fixed_perp_side === "short"
|
||||||
@@ -246,6 +262,10 @@ export default function PlanPage() {
|
|||||||
<span className="plan-rules-k">行情</span>
|
<span className="plan-rules-k">行情</span>
|
||||||
{String(plan?.exchange || "okx").toUpperCase()} · ETH-USDT-SWAP
|
{String(plan?.exchange || "okx").toUpperCase()} · ETH-USDT-SWAP
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<span className="plan-rules-k">模式</span>
|
||||||
|
{sizingModeLabel}
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span className="plan-rules-k">开仓</span>
|
<span className="plan-rules-k">开仓</span>
|
||||||
永续{" "}
|
永续{" "}
|
||||||
@@ -253,7 +273,11 @@ export default function PlanPage() {
|
|||||||
? `${fmt(displayPerpQty, 2)} ETH`
|
? `${fmt(displayPerpQty, 2)} ETH`
|
||||||
: "—"}{" "}
|
: "—"}{" "}
|
||||||
/ {fmt(plan?.leverage, 0)}x
|
/ {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_hours, 0)}h · 期权杠杆≥
|
||||||
{fmt(plan?.min_option_leverage, 0)}x · {atmRule}
|
{fmt(plan?.min_option_leverage, 0)}x · {atmRule}
|
||||||
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
|
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
|
||||||
@@ -357,30 +381,19 @@ export default function PlanPage() {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="kv">
|
||||||
|
<span>模式</span>
|
||||||
|
<span className="mono">
|
||||||
|
{riskBased ? (
|
||||||
|
<span className="status-running">{sizingModeLabel}</span>
|
||||||
|
) : (
|
||||||
|
sizingModeLabel
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div className="kv">
|
<div className="kv">
|
||||||
<span>选约条件</span>
|
<span>选约条件</span>
|
||||||
<span className="mono">
|
<span className="mono">
|
||||||
{plan?.risk_based || plan?.sizing_mode === "risk_based" ? (
|
|
||||||
<>
|
|
||||||
<span className="status-running">以损定仓</span>
|
|
||||||
{" · "}
|
|
||||||
比例{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
|
{displayPerpQty != null
|
||||||
? `${fmt(displayPerpQty, 2)}ETH`
|
? `${fmt(displayPerpQty, 2)}ETH`
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ export default function SettingsPage() {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<label htmlFor="sizingMode">仓位模式</label>
|
<label htmlFor="sizingMode">定仓模式</label>
|
||||||
<select
|
<select
|
||||||
id="sizingMode"
|
id="sizingMode"
|
||||||
className="mono"
|
className="mono"
|
||||||
|
|||||||
Reference in New Issue
Block a user