Hide perp signal direction in option-option mode.

Plan panel shows Call+Put structure and OO selection/exit labels instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 16:18:40 +08:00
parent 42e56d940c
commit 8d3c181246
3 changed files with 142 additions and 51 deletions
+5
View File
@@ -348,6 +348,11 @@ export type PlanState = {
risk_effective_loss_pct?: number;
risk_loss_pct?: number;
hedge_mode?: "perp_option" | "option_option";
oo_amplitude_pct?: number;
oo_amplitude_hours?: number;
oo_min_option_hours?: number;
oo_min_leverage?: number;
oo_reward_ratio?: number;
sizing_mode?: "manual" | "risk_based";
risk_based?: boolean;
ledger: { equity: number; available: number; reserved: number };
+107 -51
View File
@@ -185,6 +185,10 @@ export default function PlanPage() {
);
const pos = plan?.position;
const isOo =
plan?.hedge_mode === "option_option" ||
pos?.hedge_mode === "option_option" ||
!!pos?.option2_inst_id;
const open = !!pos?.has_position;
const exitMode = plan?.exit_mode ?? "fixed_usdt";
const riskBased =
@@ -202,20 +206,28 @@ export default function PlanPage() {
: null;
const netPnl = pos?.net_pnl ?? 0;
const movePct = pos?.move_pct ?? 0;
const exitRuleLabel =
exitMode === "premium_multiple"
const ooRatio = Number(plan?.oo_reward_ratio ?? 2);
const exitRuleLabel = isOo
? exitTarget != null
? `${riskLocked ? "锁定 " : ""}净盈≥${fmt(exitTarget)} U(预算×${fmt(ooRatio, 1)}`
: `净盈≥预算×${fmt(ooRatio, 1)}(达标只平盈利腿)`
: exitMode === "premium_multiple"
? `权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
: riskBased
? exitTarget != null
? `${riskLocked ? "锁定 " : "固定 "}${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 riskRatioLabel = isOo
? "Call:Put 1:1"
: `比例${Number(plan?.risk_perp_unit ?? 1)}:${Number(plan?.risk_option_unit ?? 2)}`;
const sizingModeLabel = riskBased
? [
plan?.hedge_mode === "option_option" ? "期期对冲" : "以损定仓",
isOo ? "期期对冲" : "以损定仓",
riskRatioLabel,
plan?.risk_last_k != null ? `k=${fmt(plan.risk_last_k, 1)}` : null,
!isOo && plan?.risk_last_k != null
? `k=${fmt(plan.risk_last_k, 1)}`
: null,
riskLocked
? exitTarget != null
? `目标锁定${fmt(exitTarget, 2)}U`
@@ -236,7 +248,7 @@ export default function PlanPage() {
]
.filter(Boolean)
.join(" ")
: plan?.hedge_mode === "option_option"
: isOo
? "期期对冲"
: "手动仓位";
const phaseLabel = PHASE_ZH[plan?.phase || ""] || plan?.phase || "—";
@@ -247,8 +259,18 @@ export default function PlanPage() {
: plan?.atm_open_offset_enabled
? `ATM偏差≤${fmt(plan?.max_atm_open_offset ?? 3, 0)}`
: "ATM偏差关";
const exitDetail =
exitMode === "premium_multiple"
const ooSelectLabel = [
`振幅≥${fmt(plan?.oo_amplitude_pct ?? 1.5, 1)}%/${fmt(plan?.oo_amplitude_hours ?? 12, 0)}h`,
"虚值Call@高·Put@低",
`剩余≥${fmt(plan?.oo_min_option_hours ?? 24, 0)}h`,
`杠杆≥${fmt(plan?.oo_min_leverage ?? 200, 0)}x`,
displayOptQty != null ? `单腿${fmt(displayOptQty, 1)}ETH` : null,
]
.filter(Boolean)
.join(" · ");
const exitDetail = isOo
? `净盈利≥预算×${fmt(ooRatio, 1)} → 只平盈利腿,亏损腿残留`
: exitMode === "premium_multiple"
? `净盈利≥初始权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
: `净盈利≥${fmt(plan?.net_profit_target ?? 15)} U`;
const expiryMs =
@@ -328,26 +350,40 @@ export default function PlanPage() {
</p>
<p>
<span className="plan-rules-k"></span>
{" "}
{displayPerpQty != null
? `${fmt(displayPerpQty, 2)} ETH`
: "—"}{" "}
/ {fmt(plan?.leverage, 0)}x
· {" "}
{displayOptQty != null
? `${fmt(displayOptQty, 2)} ETH`
: "—"}{" "}
·
{fmt(plan?.min_option_hours, 0)}h ·
{fmt(plan?.min_option_leverage, 0)}x · {atmRule}
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
{plan?.one_expiry_per_day !== false
? " · 每个到期只开一次"
: ""}
{isOo ? (
<>
{ooSelectLabel}
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
{plan?.one_expiry_per_day !== false
? " · 每个到期只开一次"
: ""}
</>
) : (
<>
{" "}
{displayPerpQty != null
? `${fmt(displayPerpQty, 2)} ETH`
: "—"}{" "}
/ {fmt(plan?.leverage, 0)}x
· {" "}
{displayOptQty != null
? `${fmt(displayOptQty, 2)} ETH`
: "—"}{" "}
·
{fmt(plan?.min_option_hours, 0)}h ·
{fmt(plan?.min_option_leverage, 0)}x · {atmRule}
{plan?.skip_weekends ? " · 周末跳过开仓" : ""}
{plan?.one_expiry_per_day !== false
? " · 每个到期只开一次"
: ""}
</>
)}
</p>
<p>
<span className="plan-rules-k"></span>
{exitDetail}
{isOo
? `${exitDetail};否则到期结算`
: `${exitDetail} → 双腿全平;期权远虚则只平永续、期权到期结算;未达标拖到期`}
</p>
<p>
<span className="plan-rules-k"></span>
@@ -460,24 +496,30 @@ export default function PlanPage() {
<div className="kv">
<span></span>
<span className="mono">
{displayPerpQty != null
? `${fmt(displayPerpQty, 2)}ETH`
: "—"}
/
{displayOptQty != null
? `${fmt(displayOptQty, 2)}ETH`
: "—"}{" "}
·
{fmt(plan?.min_option_hours, 0)}h ·
{fmt(plan?.min_option_leverage, 0)}x
{plan?.fixed_direction_enabled
? plan?.fixed_perp_side === "short"
? " · 固定空+Call(实/平)"
: " · 固定多+Put(实/平)"
: plan?.atm_open_offset_enabled
? ` · ATM偏差≤${fmt(plan?.max_atm_open_offset ?? 3, 0)}`
: " · ATM偏差关"}
{isOo ? (
ooSelectLabel
) : (
<>
{displayPerpQty != null
? `${fmt(displayPerpQty, 2)}ETH`
: "—"}
/
{displayOptQty != null
? `${fmt(displayOptQty, 2)}ETH`
: "—"}{" "}
·
{fmt(plan?.min_option_hours, 0)}h ·
{fmt(plan?.min_option_leverage, 0)}x
{plan?.fixed_direction_enabled
? plan?.fixed_perp_side === "short"
? " · 固定空+Call(实/平)"
: " · 固定多+Put(实/平)"
: plan?.atm_open_offset_enabled
? ` · ATM偏差≤${fmt(plan?.max_atm_open_offset ?? 3, 0)}`
: " · ATM偏差关"}
</>
)}
</span>
</div>
<div className="kv">
@@ -525,10 +567,20 @@ export default function PlanPage() {
</span>
</span>
</div>
<div className="kv">
<span></span>
<span className="mono">{biasTag}</span>
</div>
{isOo ? (
<div className="kv">
<span></span>
<span className="mono">
<span className="tag"> Call + Put</span>
<span className="meta"> · </span>
</span>
</div>
) : (
<div className="kv">
<span></span>
<span className="mono">{biasTag}</span>
</div>
)}
<div className="kv">
<span></span>
<span className="mono">{exitRuleLabel}</span>
@@ -540,7 +592,7 @@ export default function PlanPage() {
{open ? fmt(netPnl) : "—"}
</span>
{" / "}
{open || exitMode === "fixed_usdt"
{open || exitMode === "fixed_usdt" || isOo
? exitTarget != null
? fmt(exitTarget)
: "—"
@@ -548,11 +600,15 @@ export default function PlanPage() {
</span>
</div>
<div className="kv">
<span>/</span>
<span>{isOo ? "Call/Put 浮盈" : "永续/期权浮盈"}</span>
<span className="mono">
<span className={pnlClass(pos?.perp_upl)}>{fmt(pos?.perp_upl)}</span>
<span className={pnlClass(pos?.perp_upl)}>
{fmt(isOo ? pos?.option_upl : pos?.perp_upl)}
</span>
{" / "}
<span className={pnlClass(pos?.option_upl)}>{fmt(pos?.option_upl)}</span>
<span className={pnlClass(isOo ? pos?.option2_upl : pos?.option_upl)}>
{fmt(isOo ? pos?.option2_upl : pos?.option_upl)}
</span>
</span>
</div>
{plan?.mode === "LIVE" && open ? (