Fix running status color; add ETH qty settings with Chinese labels.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user