Add dual exit modes: fixed USDT or premium multiple.

Net PnL (after estimated close fees) drives auto close; Plan/Settings expose the choice.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 09:17:50 +08:00
parent 9fd2a842af
commit cce26e87b5
13 changed files with 282 additions and 72 deletions
+21 -8
View File
@@ -75,15 +75,20 @@ export default function PlanPage() {
const pos = plan?.position;
const open = !!pos?.has_position;
const exitPct = plan?.exit_move_pct ?? 2;
const movePct = pos?.move_pct ?? 0;
const exitMode = plan?.exit_mode ?? "fixed_usdt";
const exitTarget = plan?.exit_target_usdt ?? plan?.net_profit_target ?? 15;
const netPnl = pos?.net_pnl ?? 0;
const exitRuleLabel =
exitMode === "premium_multiple"
? `权利金×${fmt(plan?.premium_exit_multiple ?? 1, 2)}`
: `固定 ${fmt(plan?.net_profit_target ?? 15)} U`;
const phaseLabel = PHASE_ZH[plan?.phase || ""] || plan?.phase || "—";
return (
<div>
<h2 style={{ marginTop: 0 }}></h2>
<p style={{ color: "var(--muted)", marginTop: -8 }}>
SIM · · ·
SIM · · ·
</p>
{err ? <div className="err">{err}</div> : null}
@@ -174,17 +179,25 @@ export default function PlanPage() {
<span className="mono">{biasTag}</span>
</div>
<div className="kv">
<span> / </span>
<span></span>
<span className="mono">{exitRuleLabel}</span>
</div>
<div className="kv">
<span> / </span>
<span className="mono">
<span className={pnlClass(pos?.perp_upl)}>{fmt(pos?.perp_upl)}</span>
<span className={pnlClass(open ? netPnl : null)}>
{open ? fmt(netPnl) : "—"}
</span>
{" / "}
{fmt(pos?.premium_gap)}
{open || exitMode === "fixed_usdt" ? fmt(exitTarget) : "—"}
</span>
</div>
<div className="kv">
<span></span>
<span> / </span>
<span className="mono">
{fmt(movePct, 2)}% / {fmt(exitPct, 2)}%
<span className={pnlClass(pos?.perp_upl)}>{fmt(pos?.perp_upl)}</span>
{" / "}
<span className={pnlClass(pos?.option_upl)}>{fmt(pos?.option_upl)}</span>
</span>
</div>
{plan?.last_error ? (