Fix running status color; add ETH qty settings with Chinese labels.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-24 17:24:27 +08:00
parent b6d9877538
commit 5125c6702b
7 changed files with 102 additions and 47 deletions
+21 -4
View File
@@ -59,6 +59,20 @@ export default function PlanPage() {
const exitN = plan?.exit_move_points ?? 30;
const move = pos?.move_points ?? 0;
const phaseZh: Record<string, string> = {
idle: "空闲",
wait_signal: "等待信号",
opening: "开仓中",
open: "持仓中",
closing: "平仓中",
resting: "休息中",
paused: "已暂停",
stopped: "已停开",
outside_window: "窗外",
liquidity_wait: "流动性等待",
};
const phaseLabel = phaseZh[plan?.phase || ""] || plan?.phase || "—";
return (
<div>
<h2 style={{ marginTop: 0 }}></h2>
@@ -114,13 +128,16 @@ export default function PlanPage() {
<div className="card" style={{ marginBottom: 12 }}>
<div className="kv">
<span></span>
<span className="mono">
<span>
{plan?.running ? (
<span className="status-running"></span>
) : (
<span className="status-stopped"></span>
)}{" "}
· {plan?.phase || "—"} · {plan?.rounds_done ?? 0}/{plan?.max_rounds ?? 3}
)}
<span className="mono">
{" "}
· {phaseLabel} · {plan?.rounds_done ?? 0}/{plan?.max_rounds ?? 3}
</span>
</span>
</div>
<div className="kv">
@@ -147,7 +164,7 @@ export default function PlanPage() {
<span></span>
<span className="mono">
{pos?.has_position
? `永续${pos.perp_side} + 买${pos.option_side?.toUpperCase()}`
? `永续${pos.perp_side === "long" ? "多" : "空"} + 买${pos.option_side === "call" ? "Call" : "Put"}`
: "—"}{" "}
{biasTag}
</span>
+35 -5
View File
@@ -24,6 +24,8 @@ export default function SettingsPage() {
const [exitPts, setExitPts] = useState(30);
const [rest, setRest] = useState(300);
const [maxRounds, setMaxRounds] = useState(3);
const [perpQty, setPerpQty] = useState(1);
const [optQty, setOptQty] = useState(2);
const [stratOk, setStratOk] = useState("");
useEffect(() => {
@@ -33,6 +35,8 @@ export default function SettingsPage() {
setExitPts(s.exit_move_points);
setRest(s.rest_seconds);
setMaxRounds(s.max_rounds);
setPerpQty(s.perp_qty_eth ?? 1);
setOptQty(s.option_qty_eth ?? 2);
})
.catch(() => undefined);
}, []);
@@ -80,6 +84,8 @@ export default function SettingsPage() {
exit_move_points: exitPts,
rest_seconds: rest,
max_rounds: maxRounds,
perp_qty_eth: perpQty,
option_qty_eth: optQty,
}),
});
setStratOk("策略参数已保存");
@@ -111,13 +117,37 @@ export default function SettingsPage() {
{tab === "strategy" ? (
<div className="card">
<p style={{ color: "var(--muted)", marginTop: 0 }}>
N =1×
N =1×
</p>
{stratOk ? <div style={{ color: "var(--up)", marginBottom: 12 }}>{stratOk}</div> : null}
{err && tab === "strategy" ? <div className="err">{err}</div> : null}
<form onSubmit={onSaveStrategy}>
<div className="field">
<label htmlFor="exit">EXIT_MOVE_POINTS</label>
<label htmlFor="perp"> ETH </label>
<input
id="perp"
className="mono"
type="number"
step="0.01"
min="0.01"
value={perpQty}
onChange={(e) => setPerpQty(Number(e.target.value))}
/>
</div>
<div className="field">
<label htmlFor="opt"> ETH </label>
<input
id="opt"
className="mono"
type="number"
step="0.01"
min="0.01"
value={optQty}
onChange={(e) => setOptQty(Number(e.target.value))}
/>
</div>
<div className="field">
<label htmlFor="exit"></label>
<input
id="exit"
className="mono"
@@ -128,7 +158,7 @@ export default function SettingsPage() {
/>
</div>
<div className="field">
<label htmlFor="rest">REST_SECONDS</label>
<label htmlFor="rest"></label>
<input
id="rest"
className="mono"
@@ -139,7 +169,7 @@ export default function SettingsPage() {
/>
</div>
<div className="field">
<label htmlFor="rounds">MAX_ROUNDS</label>
<label htmlFor="rounds"></label>
<input
id="rounds"
className="mono"
@@ -150,7 +180,7 @@ export default function SettingsPage() {
/>
</div>
<div className="field">
<label htmlFor="fee">FEE_RATE</label>
<label htmlFor="fee"></label>
<input
id="fee"
className="mono"