Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(i18n): route the research dashboard through the locale catalogue

Haozhe Wu2c08963ad955
diff --git a/frontend/src/components/charts/StrategyResearchDashboard.tsx b/frontend/src/components/charts/StrategyResearchDashboard.tsx
index dd6051a45..6f52ecf34 100644
--- a/frontend/src/components/charts/StrategyResearchDashboard.tsx
+++ b/frontend/src/components/charts/StrategyResearchDashboard.tsx
@@ -1,4 +1,5 @@
import { useEffect, useMemo, useRef } from "react";
+import { useTranslation } from "react-i18next";
import { CalendarRange, Database, FlaskConical } from "lucide-react";
import i18n from "@/i18n";
import { echarts } from "@/lib/echarts";
@@ -12,10 +13,6 @@ const ORANGE = "#ff8a3d";
const GREEN = "#3b9b8f";
const SLATE = "#8f98a6";
-function tr(en: string, zh: string): string {
- return i18n.language.toLowerCase().startsWith("zh") ? zh : en;
-}
-
function num(value: unknown): number | null {
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : null;
@@ -53,18 +50,18 @@ function compactPrompt(prompt: string): string {
function inferStrategyName(prompt: string): string {
const zhMa = prompt.match(/(\d+)\s*(?:日|天)?\s*[\//-]\s*(\d+)\s*(?:日|天)?[^。;,,]{0,18}均线/i)
|| prompt.match(/(\d+)\s*日均线[^。;,,]{0,18}(\d+)\s*日均线/i);
- if (zhMa) return `${zhMa[1]}/${zhMa[2]} 日均线交叉策略`;
+ if (zhMa) return i18n.t("runDashboard.strategyMaCrossover", { fast: zhMa[1], slow: zhMa[2] });
const enMa = prompt.match(/(\d+)\s*[\/\-]\s*(\d+)[^.!?]{0,28}(?:moving[ -]?average|\bma\b)/i)
|| prompt.match(/(?:moving[ -]?average|\bma\b)[^.!?]{0,28}(\d+)\s*[\/\-]\s*(\d+)/i);
- if (enMa) return `${enMa[1]}/${enMa[2]}-day moving-average crossover`;
+ if (enMa) return i18n.t("runDashboard.strategyMaCrossover", { fast: enMa[1], slow: enMa[2] });
- if (/macd/i.test(prompt)) return "MACD 趋势策略";
- if (/rsi/i.test(prompt)) return "RSI 择时策略";
- if (/动量|momentum/i.test(prompt)) return "动量策略";
- if (/均值回归|mean reversion/i.test(prompt)) return "均值回归策略";
- if (/突破|breakout/i.test(prompt)) return "突破策略";
- return compactPrompt(prompt) || tr("Systematic strategy", "系统化交易策略");
+ if (/macd/i.test(prompt)) return i18n.t("runDashboard.strategyMacd");
+ if (/rsi/i.test(prompt)) return i18n.t("runDashboard.strategyRsi");
+ if (/动量|momentum/i.test(prompt)) return i18n.t("runDashboard.strategyMomentum");
+ if (/均值回归|mean reversion/i.test(prompt)) return i18n.t("runDashboard.strategyMeanReversion");
+ if (/突破|breakout/i.test(prompt)) return i18n.t("runDashboard.strategyBreakout");
+ return compactPrompt(prompt) || i18n.t("runDashboard.systematicStrategy");
}
export function getStrategyReportIdentity(run: RunData): ReportIdentity {
@@ -75,7 +72,7 @@ export function getStrategyReportIdentity(run: RunData): ReportIdentity {
const prompt = run.prompt || "";
const strategy = inferStrategyName(prompt);
const symbolLabel = symbols.length === 0
- ? tr("Portfolio", "投资组合")
+ ? i18n.t("runDashboard.portfolio")
: symbols.length <= 2
? symbols.join(" + ")
: `${symbols[0]} +${symbols.length - 1}`;
@@ -120,6 +117,7 @@ function FigureTitle({ index, title, note }: { index: string; title: string; not
}
export function StrategyResearchDashboard({ run }: { run: RunData }) {
+ const { t } = useTranslation();
const navRef = useRef<HTMLDivElement>(null);
const riskRef = useRef<HTMLDivElement>(null);
const tradesRef = useRef<HTMLDivElement>(null);
@@ -161,8 +159,8 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
xAxis: { ...axis, type: "category", data: dates, boundaryGap: false },
yAxis: { ...axis, type: "value", axisLabel: { color: theme.textColor, fontSize: 10, formatter: (v: number) => `${v.toFixed(2)}x` } },
series: [
- { name: tr("Strategy", "策略"), type: "line", showSymbol: false, data: equities.map((v) => v == null ? null : v / firstEquity), lineStyle: { color: BLUE, width: 2.5 }, itemStyle: { color: BLUE } },
- ...(benchmarks.some((value) => value != null) ? [{ name: tr("Benchmark", "基准"), type: "line", showSymbol: false, data: benchmarks.map((v) => v == null ? null : v / firstBenchmark), lineStyle: { color: SLATE, width: 1.5, type: "dashed" }, itemStyle: { color: SLATE } }] : []),
+ { name: t("runDashboard.seriesStrategy"), type: "line", showSymbol: false, data: equities.map((v) => v == null ? null : v / firstEquity), lineStyle: { color: BLUE, width: 2.5 }, itemStyle: { color: BLUE } },
+ ...(benchmarks.some((value) => value != null) ? [{ name: t("runDashboard.seriesBenchmark"), type: "line", showSymbol: false, data: benchmarks.map((v) => v == null ? null : v / firstBenchmark), lineStyle: { color: SLATE, width: 1.5, type: "dashed" }, itemStyle: { color: SLATE } }] : []),
],
});
@@ -179,8 +177,8 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
{ ...axis, type: "value", splitLine: { show: false }, axisLabel: { color: theme.textColor, fontSize: 10 } },
],
series: [
- { name: tr("Drawdown", "回撤"), type: "line", showSymbol: false, data: drawdown, lineStyle: { color: ORANGE, width: 2 }, areaStyle: { color: "rgba(255,138,61,.10)" }, itemStyle: { color: ORANGE } },
- { name: tr("Rolling Sharpe (20)", "滚动 Sharpe(20)"), type: "line", yAxisIndex: 1, showSymbol: false, connectNulls: false, data: sharpe, lineStyle: { color: GREEN, width: 1.5 }, itemStyle: { color: GREEN } },
+ { name: t("runDashboard.seriesDrawdown"), type: "line", showSymbol: false, data: drawdown, lineStyle: { color: ORANGE, width: 2 }, areaStyle: { color: "rgba(255,138,61,.10)" }, itemStyle: { color: ORANGE } },
+ { name: t("runDashboard.seriesRollingSharpe"), type: "line", yAxisIndex: 1, showSymbol: false, connectNulls: false, data: sharpe, lineStyle: { color: GREEN, width: 1.5 }, itemStyle: { color: GREEN } },
],
});
@@ -209,12 +207,12 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
const metrics: Record<string, number> = run.metrics || {};
const kpis = [
- [tr("Total return", "总收益率"), pct(metrics.total_return), BLUE],
- [tr("Annual return", "年化收益率"), pct(metrics.annual_return), DEEP_BLUE],
+ [t("runDashboard.kpiTotalReturn"), pct(metrics.total_return), BLUE],
+ [t("runDashboard.kpiAnnualReturn"), pct(metrics.annual_return), DEEP_BLUE],
["Sharpe", fixed(metrics.sharpe), GREEN],
- [tr("Max drawdown", "最大回撤"), pct(metrics.max_drawdown), ORANGE],
- [tr("Win rate", "胜率"), pct(metrics.win_rate), GREEN],
- [tr("Trades", "交易次数"), fixed(metrics.trade_count, 0), SLATE],
+ [t("runDashboard.kpiMaxDrawdown"), pct(metrics.max_drawdown), ORANGE],
+ [t("runDashboard.kpiWinRate"), pct(metrics.win_rate), GREEN],
+ [t("runDashboard.kpiTrades"), fixed(metrics.trade_count, 0), SLATE],
] as const;
return (
@@ -223,7 +221,7 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
<div className="absolute -right-16 -top-20 h-52 w-52 rounded-full bg-[#3676df]/[0.08] blur-3xl" aria-hidden="true" />
<div className="relative">
<div className="flex flex-wrap items-center justify-between gap-3">
- <p className="font-mono text-[10px] uppercase tracking-[0.22em] text-[#3676df]">{tr("Quantitative research · Backtest", "量化研究 · 策略回测")}</p>
+ <p className="font-mono text-[10px] uppercase tracking-[0.22em] text-[#3676df]">{t("runDashboard.eyebrow")}</p>
<span className="rounded-full border border-[#3676df]/20 bg-background/70 px-2.5 py-1 font-mono text-[10px] text-muted-foreground">RUN {run.run_id.slice(-8).toUpperCase()}</span>
</div>
<h2 className="mt-4 max-w-4xl text-2xl font-semibold leading-tight tracking-[-0.025em] text-foreground md:text-[30px]">{identity.title}</h2>
@@ -232,7 +230,7 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
)}
<div className="mt-5 flex flex-wrap gap-2 text-xs text-muted-foreground">
{(identity.startDate || identity.endDate) && <span className="inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-background/65 px-2.5 py-1.5"><CalendarRange className="h-3.5 w-3.5 text-[#3676df]" />{identity.startDate || "—"} — {identity.endDate || "—"}</span>}
- {identity.engine && <span className="inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-background/65 px-2.5 py-1.5"><FlaskConical className="h-3.5 w-3.5 text-[#3676df]" />{identity.engine.toUpperCase()} {tr("engine", "回测引擎")}</span>}
+ {identity.engine && <span className="inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-background/65 px-2.5 py-1.5"><FlaskConical className="h-3.5 w-3.5 text-[#3676df]" />{identity.engine.toUpperCase()} {t("runDashboard.engine")}</span>}
{identity.source && <span className="inline-flex items-center gap-1.5 rounded-md border border-border/70 bg-background/65 px-2.5 py-1.5"><Database className="h-3.5 w-3.5 text-[#3676df]" />{identity.source}</span>}
</div>
</div>
@@ -243,19 +241,20 @@ export function StrategyResearchDashboard({ run }: { run: RunData }) {
</div>
<div className="space-y-8 p-5 md:p-7">
- <section className="space-y-3"><FigureTitle index="01" title={tr("Equity and benchmark", "净值与基准")} note={tr("Compare the strategy's growth path with its benchmark.", "比较策略与基准的累计收益路径。")} /><div ref={navRef} className="h-[320px] border border-[#dfe2e7] bg-background/40" /></section>
- <section className="space-y-3"><FigureTitle index="02" title={tr("Drawdown and rolling risk", "回撤与滚动风险")} note={tr("See when losses deepened and risk-adjusted performance changed.", "观察亏损加深和风险调整后表现发生变化的时点。")} /><div ref={riskRef} className="h-[300px] border border-[#dfe2e7] bg-background/40" /></section>
- <section className="space-y-3"><FigureTitle index="03" title={tr("Realized trade P&L", "已实现成交盈亏")} note={tr("Profit and loss from completed trades.", "展示已完成交易带来的实际盈亏。")} /><div ref={tradesRef} className="h-[260px] border border-[#dfe2e7] bg-background/40" /></section>
- <section className="space-y-3"><FigureTitle index="04" title={tr("Trade ledger", "成交明细")} note={tr("Review the latest 100 trades in chronological detail.", "按时间查看最近 100 笔交易明细。")} /><TradeTable rows={trades.slice(-100).reverse()} /></section>
- <section className="space-y-3"><FigureTitle index="05" title={tr("Performance metrics", "绩效指标")} note={tr("A complete summary of return, risk, and trading statistics.", "汇总策略的收益、风险与交易统计。")} /><MetricTable metrics={metrics} /></section>
+ <section className="space-y-3"><FigureTitle index="01" title={t("runDashboard.figEquityTitle")} note={t("runDashboard.figEquityNote")} /><div ref={navRef} className="h-[320px] border border-[#dfe2e7] bg-background/40" /></section>
+ <section className="space-y-3"><FigureTitle index="02" title={t("runDashboard.figRiskTitle")} note={t("runDashboard.figRiskNote")} /><div ref={riskRef} className="h-[300px] border border-[#dfe2e7] bg-background/40" /></section>
+ <section className="space-y-3"><FigureTitle index="03" title={t("runDashboard.figPnlTitle")} note={t("runDashboard.figPnlNote")} /><div ref={tradesRef} className="h-[260px] border border-[#dfe2e7] bg-background/40" /></section>
+ <section className="space-y-3"><FigureTitle index="04" title={t("runDashboard.figLedgerTitle")} note={t("runDashboard.figLedgerNote")} /><TradeTable rows={trades.slice(-100).reverse()} /></section>
+ <section className="space-y-3"><FigureTitle index="05" title={t("runDashboard.figMetricsTitle")} note={t("runDashboard.figMetricsNote")} /><MetricTable metrics={metrics} /></section>
</div>
</article>
);
}
function TradeTable({ rows }: { rows: Array<Record<string, string>> }) {
- if (!rows.length) return <EmptyData text={tr("No trades were recorded.", "没有成交记录。")} />;
- return <div className="max-h-[440px] overflow-auto border border-[#dfe2e7]"><table className="w-full min-w-[760px] text-xs"><thead className="sticky top-0 bg-[#f5f7fa] text-muted-foreground dark:bg-slate-900"><tr><th className="px-3 py-2 text-left">Time</th><th className="px-3 py-2 text-left">Symbol</th><th className="px-3 py-2 text-left">Side</th><th className="px-3 py-2 text-right">Price</th><th className="px-3 py-2 text-right">Qty</th><th className="px-3 py-2 text-right">PnL</th><th className="px-3 py-2 text-left">Reason</th></tr></thead><tbody>{rows.map((row, index) => { const pnl = num(row.pnl) || 0; return <tr key={`${row.timestamp}-${row.code}-${index}`} className="border-t border-[#dfe2e7]"><td className="px-3 py-2 font-mono">{row.timestamp || "—"}</td><td className="px-3 py-2 font-mono">{row.code || "—"}</td><td className="px-3 py-2 uppercase">{row.side || "—"}</td><td className="px-3 py-2 text-right font-mono">{fixed(row.price, 4)}</td><td className="px-3 py-2 text-right font-mono">{fixed(row.qty, 4)}</td><td className="px-3 py-2 text-right font-mono font-semibold" style={{ color: pnl > 0 ? GREEN : pnl < 0 ? ORANGE : SLATE }}>{fixed(pnl)}</td><td className="px-3 py-2 text-muted-foreground">{row.reason || "—"}</td></tr>; })}</tbody></table></div>;
+ const { t } = useTranslation();
+ if (!rows.length) return <EmptyData text={t("runDashboard.noTrades")} />;
+ return <div className="max-h-[440px] overflow-auto border border-[#dfe2e7]"><table className="w-full min-w-[760px] text-xs"><thead className="sticky top-0 bg-[#f5f7fa] text-muted-foreground dark:bg-slate-900"><tr><th className="px-3 py-2 text-left">{t("runDashboard.colTime")}</th><th className="px-3 py-2 text-left">{t("runDashboard.colSymbol")}</th><th className="px-3 py-2 text-left">{t("runDashboard.colSide")}</th><th className="px-3 py-2 text-right">{t("runDashboard.colPrice")}</th><th className="px-3 py-2 text-right">{t("runDashboard.colQty")}</th><th className="px-3 py-2 text-right">{t("runDashboard.colPnl")}</th><th className="px-3 py-2 text-left">{t("runDashboard.colReason")}</th></tr></thead><tbody>{rows.map((row, index) => { const pnl = num(row.pnl) || 0; return <tr key={`${row.timestamp}-${row.code}-${index}`} className="border-t border-[#dfe2e7]"><td className="px-3 py-2 font-mono">{row.timestamp || "—"}</td><td className="px-3 py-2 font-mono">{row.code || "—"}</td><td className="px-3 py-2 uppercase">{row.side || "—"}</td><td className="px-3 py-2 text-right font-mono">{fixed(row.price, 4)}</td><td className="px-3 py-2 text-right font-mono">{fixed(row.qty, 4)}</td><td className="px-3 py-2 text-right font-mono font-semibold" style={{ color: pnl > 0 ? GREEN : pnl < 0 ? ORANGE : SLATE }}>{fixed(pnl)}</td><td className="px-3 py-2 text-muted-foreground">{row.reason || "—"}</td></tr>; })}</tbody></table></div>;
}
function MetricTable({ metrics }: { metrics: Record<string, number> }) {
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index fe2ee23fd..fc848e30e 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -614,7 +614,8 @@
"sideSell": "بيع",
"copyCode": "نسخ",
"codeCopied": "تم نسخ الكود",
- "codeLines": "{{count}} سطر"
+ "codeLines": "{{count}} سطر",
+ "dashboard": "لوحة البحث"
},
"compare": {
"title": "مقارنة الاستراتيجيات",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "تحديث حالة الهدف",
"web_search": "البحث في الويب",
"write_file": "إنشاء الشيفرة"
+ },
+ "runDashboard": {
+ "eyebrow": "بحث كمّي · اختبار رجعي",
+ "engine": "محرك",
+ "portfolio": "محفظة",
+ "systematicStrategy": "استراتيجية منهجية",
+ "strategyMacd": "استراتيجية اتجاه MACD",
+ "strategyRsi": "استراتيجية توقيت RSI",
+ "strategyMomentum": "استراتيجية الزخم",
+ "strategyMeanReversion": "استراتيجية العودة إلى المتوسط",
+ "strategyBreakout": "استراتيجية الاختراق",
+ "strategyMaCrossover": "تقاطع المتوسط المتحرك {{fast}}/{{slow}} يوم",
+ "seriesStrategy": "الاستراتيجية",
+ "seriesBenchmark": "المؤشر المرجعي",
+ "seriesDrawdown": "التراجع",
+ "seriesRollingSharpe": "شارب المتحرك (20)",
+ "kpiTotalReturn": "إجمالي العائد",
+ "kpiAnnualReturn": "العائد السنوي",
+ "kpiMaxDrawdown": "أقصى تراجع",
+ "kpiWinRate": "نسبة الربح",
+ "kpiTrades": "عدد التداولات",
+ "figEquityTitle": "منحنى رأس المال والمؤشر المرجعي",
+ "figEquityNote": "قارن مسار نمو الاستراتيجية بمؤشرها المرجعي.",
+ "figRiskTitle": "التراجع والمخاطر المتحركة",
+ "figRiskNote": "تعرّف على اللحظات التي تعمّقت فيها الخسائر وتغيّر الأداء المعدّل بالمخاطر.",
+ "figPnlTitle": "الأرباح والخسائر المحققة",
+ "figPnlNote": "الأرباح والخسائر الناتجة عن التداولات المكتملة.",
+ "figLedgerTitle": "سجل التداولات",
+ "figLedgerNote": "راجع أحدث 100 تداول بالتفصيل الزمني.",
+ "figMetricsTitle": "مقاييس الأداء",
+ "figMetricsNote": "ملخّص كامل للعائد والمخاطر وإحصاءات التداول.",
+ "noTrades": "لم يُسجَّل أي تداول.",
+ "colTime": "الوقت",
+ "colSymbol": "الرمز",
+ "colSide": "الاتجاه",
+ "colPrice": "السعر",
+ "colQty": "الكمية",
+ "colPnl": "الربح/الخسارة",
+ "colReason": "السبب"
}
}
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index bb60a22c8..50cd27427 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -619,7 +619,8 @@
"sideSell": "Sell",
"copyCode": "Copy",
"codeCopied": "Code copied",
- "codeLines": "{{count}} lines"
+ "codeLines": "{{count}} lines",
+ "dashboard": "Research dashboard"
},
"compare": {
"title": "Strategy Comparison",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "Update goal status",
"web_search": "Search the web",
"write_file": "Generate code"
+ },
+ "runDashboard": {
+ "eyebrow": "Quantitative research · Backtest",
+ "engine": "engine",
+ "portfolio": "Portfolio",
+ "systematicStrategy": "Systematic strategy",
+ "strategyMacd": "MACD trend strategy",
+ "strategyRsi": "RSI timing strategy",
+ "strategyMomentum": "Momentum strategy",
+ "strategyMeanReversion": "Mean-reversion strategy",
+ "strategyBreakout": "Breakout strategy",
+ "strategyMaCrossover": "{{fast}}/{{slow}}-day moving-average crossover",
+ "seriesStrategy": "Strategy",
+ "seriesBenchmark": "Benchmark",
+ "seriesDrawdown": "Drawdown",
+ "seriesRollingSharpe": "Rolling Sharpe (20)",
+ "kpiTotalReturn": "Total return",
+ "kpiAnnualReturn": "Annual return",
+ "kpiMaxDrawdown": "Max drawdown",
+ "kpiWinRate": "Win rate",
+ "kpiTrades": "Trades",
+ "figEquityTitle": "Equity and benchmark",
+ "figEquityNote": "Compare the strategy's growth path with its benchmark.",
+ "figRiskTitle": "Drawdown and rolling risk",
+ "figRiskNote": "See when losses deepened and risk-adjusted performance changed.",
+ "figPnlTitle": "Realized trade P&L",
+ "figPnlNote": "Profit and loss from completed trades.",
+ "figLedgerTitle": "Trade ledger",
+ "figLedgerNote": "Review the latest 100 trades in chronological detail.",
+ "figMetricsTitle": "Performance metrics",
+ "figMetricsNote": "A complete summary of return, risk, and trading statistics.",
+ "noTrades": "No trades were recorded.",
+ "colTime": "Time",
+ "colSymbol": "Symbol",
+ "colSide": "Side",
+ "colPrice": "Price",
+ "colQty": "Qty",
+ "colPnl": "PnL",
+ "colReason": "Reason"
}
}
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index a974b7870..7a66afb36 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -619,7 +619,8 @@
"sideSell": "Venta",
"copyCode": "Copiar",
"codeCopied": "Código copiado",
- "codeLines": "{{count}} líneas"
+ "codeLines": "{{count}} líneas",
+ "dashboard": "Panel de investigación"
},
"compare": {
"title": "Comparación de estrategias",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "Actualizar estado del objetivo",
"web_search": "Buscar en la web",
"write_file": "Generar código"
+ },
+ "runDashboard": {
+ "eyebrow": "Investigación cuantitativa · Backtest",
+ "engine": "motor",
+ "portfolio": "Cartera",
+ "systematicStrategy": "Estrategia sistemática",
+ "strategyMacd": "Estrategia de tendencia MACD",
+ "strategyRsi": "Estrategia de timing RSI",
+ "strategyMomentum": "Estrategia de momentum",
+ "strategyMeanReversion": "Estrategia de reversión a la media",
+ "strategyBreakout": "Estrategia de ruptura",
+ "strategyMaCrossover": "Cruce de medias móviles {{fast}}/{{slow}} días",
+ "seriesStrategy": "Estrategia",
+ "seriesBenchmark": "Referencia",
+ "seriesDrawdown": "Drawdown",
+ "seriesRollingSharpe": "Sharpe móvil (20)",
+ "kpiTotalReturn": "Rentabilidad total",
+ "kpiAnnualReturn": "Rentabilidad anualizada",
+ "kpiMaxDrawdown": "Drawdown máximo",
+ "kpiWinRate": "Tasa de acierto",
+ "kpiTrades": "Operaciones",
+ "figEquityTitle": "Valor de cuenta y referencia",
+ "figEquityNote": "Compara la trayectoria de crecimiento de la estrategia con su referencia.",
+ "figRiskTitle": "Drawdown y riesgo móvil",
+ "figRiskNote": "Observa cuándo se profundizaron las pérdidas y cambió el rendimiento ajustado al riesgo.",
+ "figPnlTitle": "P&L realizado",
+ "figPnlNote": "Pérdidas y ganancias de las operaciones cerradas.",
+ "figLedgerTitle": "Registro de operaciones",
+ "figLedgerNote": "Revisa las últimas 100 operaciones en detalle cronológico.",
+ "figMetricsTitle": "Métricas de rendimiento",
+ "figMetricsNote": "Un resumen completo de rentabilidad, riesgo y estadísticas de operaciones.",
+ "noTrades": "No se registraron operaciones.",
+ "colTime": "Hora",
+ "colSymbol": "Símbolo",
+ "colSide": "Lado",
+ "colPrice": "Precio",
+ "colQty": "Cantidad",
+ "colPnl": "P&L",
+ "colReason": "Motivo"
}
}
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index 531999099..410a3415a 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -614,7 +614,8 @@
"sideSell": "売り",
"copyCode": "コピー",
"codeCopied": "コードをコピーしました",
- "codeLines": "{{count}} 行"
+ "codeLines": "{{count}} 行",
+ "dashboard": "リサーチダッシュボード"
},
"compare": {
"title": "戦略比較",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "目標の状態を更新",
"web_search": "Web を検索",
"write_file": "コードを生成"
+ },
+ "runDashboard": {
+ "eyebrow": "定量リサーチ · バックテスト",
+ "engine": "エンジン",
+ "portfolio": "ポートフォリオ",
+ "systematicStrategy": "システマティック戦略",
+ "strategyMacd": "MACD トレンド戦略",
+ "strategyRsi": "RSI タイミング戦略",
+ "strategyMomentum": "モメンタム戦略",
+ "strategyMeanReversion": "平均回帰戦略",
+ "strategyBreakout": "ブレイクアウト戦略",
+ "strategyMaCrossover": "{{fast}}/{{slow}}日移動平均クロス戦略",
+ "seriesStrategy": "戦略",
+ "seriesBenchmark": "ベンチマーク",
+ "seriesDrawdown": "ドローダウン",
+ "seriesRollingSharpe": "ローリングシャープ(20)",
+ "kpiTotalReturn": "総リターン",
+ "kpiAnnualReturn": "年率リターン",
+ "kpiMaxDrawdown": "最大ドローダウン",
+ "kpiWinRate": "勝率",
+ "kpiTrades": "取引回数",
+ "figEquityTitle": "資産推移とベンチマーク",
+ "figEquityNote": "戦略の資産成長をベンチマークと比較します。",
+ "figRiskTitle": "ドローダウンとローリングリスク",
+ "figRiskNote": "損失が深まり、リスク調整後パフォーマンスが変化した時点を確認します。",
+ "figPnlTitle": "実現損益",
+ "figPnlNote": "完了した取引による損益です。",
+ "figLedgerTitle": "取引明細",
+ "figLedgerNote": "直近 100 件の取引を時系列で確認します。",
+ "figMetricsTitle": "パフォーマンス指標",
+ "figMetricsNote": "リターン・リスク・取引統計の総括です。",
+ "noTrades": "取引記録がありません。",
+ "colTime": "時刻",
+ "colSymbol": "銘柄",
+ "colSide": "売買",
+ "colPrice": "価格",
+ "colQty": "数量",
+ "colPnl": "損益",
+ "colReason": "理由"
}
}
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index d4f616167..a5c7ae860 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -614,7 +614,8 @@
"sideSell": "매도",
"copyCode": "복사",
"codeCopied": "코드가 복사되었습니다",
- "codeLines": "{{count}}줄"
+ "codeLines": "{{count}}줄",
+ "dashboard": "리서치 대시보드"
},
"compare": {
"title": "전략 비교",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "목표 상태 업데이트",
"web_search": "웹 검색",
"write_file": "코드 생성"
+ },
+ "runDashboard": {
+ "eyebrow": "계량 리서치 · 백테스트",
+ "engine": "엔진",
+ "portfolio": "포트폴리오",
+ "systematicStrategy": "시스테매틱 전략",
+ "strategyMacd": "MACD 추세 전략",
+ "strategyRsi": "RSI 타이밍 전략",
+ "strategyMomentum": "모멘텀 전략",
+ "strategyMeanReversion": "평균회귀 전략",
+ "strategyBreakout": "돌파 전략",
+ "strategyMaCrossover": "{{fast}}/{{slow}}일 이동평균 교차 전략",
+ "seriesStrategy": "전략",
+ "seriesBenchmark": "벤치마크",
+ "seriesDrawdown": "낙폭",
+ "seriesRollingSharpe": "롤링 샤프(20)",
+ "kpiTotalReturn": "총수익률",
+ "kpiAnnualReturn": "연환산 수익률",
+ "kpiMaxDrawdown": "최대 낙폭",
+ "kpiWinRate": "승률",
+ "kpiTrades": "거래 횟수",
+ "figEquityTitle": "자산곡선과 벤치마크",
+ "figEquityNote": "전략의 자산 성장 경로를 벤치마크와 비교합니다.",
+ "figRiskTitle": "낙폭과 롤링 리스크",
+ "figRiskNote": "손실이 깊어지고 위험조정 성과가 변한 시점을 확인합니다.",
+ "figPnlTitle": "실현 손익",
+ "figPnlNote": "완료된 거래에서 발생한 손익입니다.",
+ "figLedgerTitle": "거래 원장",
+ "figLedgerNote": "최근 100건의 거래를 시간순으로 확인합니다.",
+ "figMetricsTitle": "성과 지표",
+ "figMetricsNote": "수익·위험·거래 통계 전체 요약입니다.",
+ "noTrades": "거래 기록이 없습니다.",
+ "colTime": "시간",
+ "colSymbol": "종목",
+ "colSide": "방향",
+ "colPrice": "가격",
+ "colQty": "수량",
+ "colPnl": "손익",
+ "colReason": "사유"
}
}
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index 607e45955..a0cb3d13e 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -614,7 +614,8 @@
"sideSell": "卖出",
"copyCode": "复制",
"codeCopied": "代码已复制",
- "codeLines": "{{count}} 行"
+ "codeLines": "{{count}} 行",
+ "dashboard": "研究仪表盘"
},
"compare": {
"title": "策略对比",
@@ -1135,5 +1136,44 @@
"update_research_goal_status": "更新目标状态",
"web_search": "搜索网页",
"write_file": "生成代码"
+ },
+ "runDashboard": {
+ "eyebrow": "量化研究 · 策略回测",
+ "engine": "回测引擎",
+ "portfolio": "投资组合",
+ "systematicStrategy": "系统化交易策略",
+ "strategyMacd": "MACD 趋势策略",
+ "strategyRsi": "RSI 择时策略",
+ "strategyMomentum": "动量策略",
+ "strategyMeanReversion": "均值回归策略",
+ "strategyBreakout": "突破策略",
+ "strategyMaCrossover": "{{fast}}/{{slow}} 日均线交叉策略",
+ "seriesStrategy": "策略",
+ "seriesBenchmark": "基准",
+ "seriesDrawdown": "回撤",
+ "seriesRollingSharpe": "滚动 Sharpe(20)",
+ "kpiTotalReturn": "总收益率",
+ "kpiAnnualReturn": "年化收益率",
+ "kpiMaxDrawdown": "最大回撤",
+ "kpiWinRate": "胜率",
+ "kpiTrades": "交易次数",
+ "figEquityTitle": "净值与基准",
+ "figEquityNote": "比较策略与基准的累计收益路径。",
+ "figRiskTitle": "回撤与滚动风险",
+ "figRiskNote": "观察亏损加深和风险调整后表现发生变化的时点。",
+ "figPnlTitle": "已实现成交盈亏",
+ "figPnlNote": "展示已完成交易带来的实际盈亏。",
+ "figLedgerTitle": "成交明细",
+ "figLedgerNote": "按时间查看最近 100 笔交易明细。",
+ "figMetricsTitle": "绩效指标",
+ "figMetricsNote": "汇总策略的收益、风险与交易统计。",
+ "noTrades": "没有成交记录。",
+ "colTime": "时间",
+ "colSymbol": "代码",
+ "colSide": "方向",
+ "colPrice": "价格",
+ "colQty": "数量",
+ "colPnl": "盈亏",
+ "colReason": "原因"
}
}
diff --git a/frontend/src/pages/RunDetail.tsx b/frontend/src/pages/RunDetail.tsx
index 185a4ce67..c5d7c8698 100644
--- a/frontend/src/pages/RunDetail.tsx
+++ b/frontend/src/pages/RunDetail.tsx
@@ -122,7 +122,7 @@ export function RunDetail() {
const hasRunCard = !!run?.run_card;
const hasStudio = !!run?.risk_xray || !!run?.rebalance_notes;
const TABS: { id: Tab; label: string; icon: typeof BarChart3; hidden?: boolean }[] = [
- { id: "dashboard", label: i18n.language.toLowerCase().startsWith("zh") ? "研究 Dashboard" : "Research dashboard", icon: LayoutDashboard },
+ { id: "dashboard", label: i18n.t("runDetail.dashboard"), icon: LayoutDashboard },
{ id: "chart", label: i18n.t("runDetail.chart"), icon: BarChart3 },
{ id: "trades", label: i18n.t("runDetail.trades"), icon: List },
{ id: "studio", label: i18n.t("runDetail.studio"), icon: Gauge, hidden: !hasStudio },
diff --git a/frontend/src/pages/__tests__/RunDetail.test.tsx b/frontend/src/pages/__tests__/RunDetail.test.tsx
index 68a883f1c..c48f9ffab 100644
--- a/frontend/src/pages/__tests__/RunDetail.test.tsx
+++ b/frontend/src/pages/__tests__/RunDetail.test.tsx
@@ -61,10 +61,40 @@ describe("RunDetail page", () => {
renderRunDetail("/runs/20260811_110751_32_d951c8?view=dashboard");
- expect(await screen.findByRole("heading", { name: "000001.SZ · 20/50 日均线交叉策略" })).toBeInTheDocument();
+ // The strategy name is report chrome derived from the prompt, so it follows
+ // the UI language, not the prompt's. A Chinese prompt under an English UI
+ // must not leak a Chinese title into an otherwise English report.
+ expect(
+ await screen.findByRole("heading", { name: "000001.SZ · 20/50-day moving-average crossover" })
+ ).toBeInTheDocument();
expect(screen.getByText("RUN 20260811_110751_32_d951c8")).toHaveClass("text-[10px]");
});
+ it("renders the derived strategy name in the active UI language", async () => {
+ const i18n = (await import("@/i18n")).default;
+ apiMock.getRun.mockResolvedValue({
+ status: "success",
+ run_id: "zh-run",
+ prompt: "回测 000001.SZ 在 2024 年的 20/50 日均线交叉策略。",
+ chart_symbols: ["000001.SZ"],
+ });
+ apiMock.getRunCode.mockResolvedValueOnce({});
+ const previous = i18n.language;
+ await act(async () => {
+ await i18n.changeLanguage("zh-CN");
+ });
+ try {
+ renderRunDetail("/runs/zh-run?view=dashboard");
+ expect(
+ await screen.findByRole("heading", { name: "000001.SZ · 20/50 日均线交叉策略" })
+ ).toBeInTheDocument();
+ } finally {
+ await act(async () => {
+ await i18n.changeLanguage(previous);
+ });
+ }
+ });
+
it("opens the research dashboard when requested by the terminal report URL", async () => {
apiMock.getRun.mockResolvedValue({ status: "success", run_id: "terminal-run", prompt: "MA strategy" });
apiMock.getRunCode.mockResolvedValue({});