diff --git a/frontend/app/strategy-plaza/[id]/edit/page.tsx b/frontend/app/strategy-plaza/[id]/edit/page.tsx index c0fe57d..b25b9cd 100644 --- a/frontend/app/strategy-plaza/[id]/edit/page.tsx +++ b/frontend/app/strategy-plaza/[id]/edit/page.tsx @@ -33,12 +33,19 @@ export default function EditStrategyPage() { weight_aux: s.weight_aux, weight_momentum: s.weight_momentum, entry_score: s.entry_score, + // 门1 波动率 + gate_vol_enabled: s.gate_vol_enabled, + vol_atr_pct_min: s.vol_atr_pct_min, + // 门2 CVD共振 + gate_cvd_enabled: s.gate_cvd_enabled ?? true, + // 门3 鲸鱼否决 + gate_whale_enabled: s.gate_whale_enabled, + whale_usd_threshold: s.whale_usd_threshold, + whale_flow_pct: s.whale_flow_pct, + // 门4 OBI否决 gate_obi_enabled: s.gate_obi_enabled, obi_threshold: s.obi_threshold, - gate_whale_enabled: s.gate_whale_enabled, - whale_cvd_threshold: s.whale_cvd_threshold, - gate_vol_enabled: s.gate_vol_enabled, - atr_percentile_min: s.atr_percentile_min, + // 门5 期现背离 gate_spot_perp_enabled: s.gate_spot_perp_enabled, spot_perp_threshold: s.spot_perp_threshold, sl_atr_multiplier: s.sl_atr_multiplier, diff --git a/frontend/app/strategy-plaza/[id]/page.tsx b/frontend/app/strategy-plaza/[id]/page.tsx index f2b0264..e886199 100644 --- a/frontend/app/strategy-plaza/[id]/page.tsx +++ b/frontend/app/strategy-plaza/[id]/page.tsx @@ -59,12 +59,19 @@ interface StrategyDetail { weight_aux: number; weight_momentum: number; entry_score: number; + // 门1 波动率 + gate_vol_enabled: boolean; + vol_atr_pct_min: number; + // 门2 CVD共振 + gate_cvd_enabled: boolean; + // 门3 鲸鱼否决 + gate_whale_enabled: boolean; + whale_usd_threshold: number; + whale_flow_pct: number; + // 门4 OBI否决 gate_obi_enabled: boolean; obi_threshold: number; - gate_whale_enabled: boolean; - whale_cvd_threshold: number; - gate_vol_enabled: boolean; - atr_percentile_min: number; + // 门5 期现背离 gate_spot_perp_enabled: boolean; spot_perp_threshold: number; sl_atr_multiplier: number; @@ -150,13 +157,14 @@ function ConfigTab({ detail, strategyId }: { detail: StrategyDetail; strategyId: {row("入场阈值", `${detail.entry_score} 分`)} - {/* 四道 Gate */} + {/* 五道 Gate */}

过滤门控 (Gate)

- {gateRow("Gate1 OBI", detail.gate_obi_enabled, `≥ ${detail.obi_threshold}`)} - {gateRow("Gate2 大单CVD", detail.gate_whale_enabled, `≥ ${detail.whale_cvd_threshold}`)} - {gateRow("Gate3 ATR%", detail.gate_vol_enabled, `≥ ${detail.atr_percentile_min}%`)} - {gateRow("Gate4 现货溢价", detail.gate_spot_perp_enabled, `≤ ${detail.spot_perp_threshold}`)} + {gateRow("门1 波动率", detail.gate_vol_enabled, `ATR% ≥ ${((detail.vol_atr_pct_min ?? 0) * 100).toFixed(2)}%`)} + {gateRow("门2 CVD共振", detail.gate_cvd_enabled ?? true, "快慢CVD同向")} + {gateRow("门3 鲸鱼否决", detail.gate_whale_enabled, `USD ≥ $${((detail.whale_usd_threshold ?? 50000) / 1000).toFixed(0)}k`)} + {gateRow("门4 OBI否决", detail.gate_obi_enabled, `阈值 ${detail.obi_threshold}`)} + {gateRow("门5 期现背离", detail.gate_spot_perp_enabled, `溢价 ≤ ${((detail.spot_perp_threshold ?? 0.005) * 100).toFixed(2)}%`)}
{/* 风控参数 */} @@ -235,12 +243,14 @@ export default function StrategyDetailPage() { weight_aux: s.weight_aux, weight_momentum: s.weight_momentum, entry_score: s.entry_score, + gate_vol_enabled: s.gate_vol_enabled, + vol_atr_pct_min: s.vol_atr_pct_min, + gate_cvd_enabled: s.gate_cvd_enabled, + gate_whale_enabled: s.gate_whale_enabled, + whale_usd_threshold: s.whale_usd_threshold, + whale_flow_pct: s.whale_flow_pct, gate_obi_enabled: s.gate_obi_enabled, obi_threshold: s.obi_threshold, - gate_whale_enabled: s.gate_whale_enabled, - whale_cvd_threshold: s.whale_cvd_threshold, - gate_vol_enabled: s.gate_vol_enabled, - atr_percentile_min: s.atr_percentile_min, gate_spot_perp_enabled: s.gate_spot_perp_enabled, spot_perp_threshold: s.spot_perp_threshold, sl_atr_multiplier: s.sl_atr_multiplier, diff --git a/frontend/components/StrategyForm.tsx b/frontend/components/StrategyForm.tsx index 739d376..2ec2ce5 100644 --- a/frontend/components/StrategyForm.tsx +++ b/frontend/components/StrategyForm.tsx @@ -73,6 +73,44 @@ export const DEFAULT_FORM: StrategyFormData = { description: "", }; +// ─── Per-symbol 推荐值 ──────────────────────────────────────────────────────── +// 来自 v53.json symbol_gates,与 signal_engine.py 默认值保持一致 +export const SYMBOL_RECOMMENDED: Record> = { + BTCUSDT: { + vol_atr_pct_min: 0.002, // ATR需>价格0.2% + whale_usd_threshold: 100000, // 鲸鱼单>10万USD + whale_flow_pct: 0.5, // BTC鲸鱼流量>50%才否决 + obi_threshold: 0.30, // OBI阈值宽松(BTC流动性好) + spot_perp_threshold: 0.003, // 期现溢价<0.3% + }, + ETHUSDT: { + vol_atr_pct_min: 0.003, // ETH波动需更大 + whale_usd_threshold: 50000, + whale_flow_pct: 0.5, + obi_threshold: 0.35, + spot_perp_threshold: 0.005, + }, + SOLUSDT: { + vol_atr_pct_min: 0.004, // SOL波动更剧烈,需更高阈值 + whale_usd_threshold: 20000, + whale_flow_pct: 0.5, + obi_threshold: 0.45, // SOL OBI噪音多,需更严 + spot_perp_threshold: 0.008, + }, + XRPUSDT: { + vol_atr_pct_min: 0.0025, + whale_usd_threshold: 30000, + whale_flow_pct: 0.5, + obi_threshold: 0.40, + spot_perp_threshold: 0.006, + }, +}; + +export function applySymbolDefaults(form: StrategyFormData, symbol: string): StrategyFormData { + const rec = SYMBOL_RECOMMENDED[symbol] || SYMBOL_RECOMMENDED["BTCUSDT"]; + return { ...form, symbol, ...rec }; +} + // ─── Helper Components ──────────────────────────────────────────────────────── function FieldLabel({ label, hint }: { label: string; hint?: string }) { return ( @@ -256,7 +294,14 @@ export default function StrategyForm({ mode, initialData, strategyId, onSuccess, set("symbol", v)} + onChange={(v) => { + if (mode === "create") { + // 新建时切换币种自动填入推荐值 + setForm((prev) => applySymbolDefaults(prev, v)); + } else { + set("symbol", v); + } + }} options={[ { label: "BTC/USDT", value: "BTCUSDT" }, { label: "ETH/USDT", value: "ETHUSDT" }, @@ -376,13 +421,23 @@ export default function StrategyForm({ mode, initialData, strategyId, onSuccess,

过滤门控(Gate)

+ {/* 推荐值提示 */} + {(() => { + const rec = SYMBOL_RECOMMENDED[form.symbol]; + if (!rec) return null; + return ( +
+ 📌 {form.symbol.replace("USDT","")} 推荐值:ATR%≥{((rec.vol_atr_pct_min??0)*100).toFixed(2)}%,鲸鱼≥${((rec.whale_usd_threshold??50000)/1000).toFixed(0)}k,OBI阈值{rec.obi_threshold} +
+ ); + })()} set("gate_vol_enabled", !form.gate_vol_enabled)} > - + set("vol_atr_pct_min", v)} min={0.0001} max={0.02} step={0.0005} /> set("gate_whale_enabled", !form.gate_whale_enabled)} > - + set("whale_usd_threshold", v)} min={1000} max={1000000} step={5000} /> - + set("whale_flow_pct", v)} min={0} max={1} step={0.05} /> set("gate_obi_enabled", !form.gate_obi_enabled)} > - + set("obi_threshold", v)} min={0.1} max={0.9} step={0.05} /> set("gate_spot_perp_enabled", !form.gate_spot_perp_enabled)} > - + set("spot_perp_threshold", v)} min={0.0005} max={0.01} step={0.0005} />