diff --git a/web/src/components/ComparisonChart.tsx b/web/src/components/ComparisonChart.tsx index 56810e0e..7a933920 100644 --- a/web/src/components/ComparisonChart.tsx +++ b/web/src/components/ComparisonChart.tsx @@ -92,8 +92,13 @@ export function ComparisonChart({ traders }: ComparisonChartProps) { }); } + // 计算盈亏百分比:从total_pnl和balance计算 + // 假设初始余额 = balance - total_pnl + const initialBalance = point.balance - point.total_pnl; + const pnlPct = initialBalance > 0 ? (point.total_pnl / initialBalance) * 100 : 0; + timestampMap.get(ts)!.traders.set(trader.trader_id, { - pnl_pct: point.total_pnl_pct, + pnl_pct: pnlPct, equity: point.total_equity }); }); @@ -228,7 +233,23 @@ export function ComparisonChart({ traders }: ComparisonChartProps) { return (
-
+
+ {/* NOFX Watermark */} +
+ NOFX +
diff --git a/web/src/components/CompetitionPage.tsx b/web/src/components/CompetitionPage.tsx index 3168bd14..d719472e 100644 --- a/web/src/components/CompetitionPage.tsx +++ b/web/src/components/CompetitionPage.tsx @@ -41,7 +41,7 @@ export function CompetitionPage() { setSelectedTrader(null); }; - if (!competition || !competition.traders) { + if (!competition) { return (
@@ -64,6 +64,47 @@ export function CompetitionPage() { ); } + // 如果有数据返回但没有交易员,显示空状态 + if (!competition.traders || competition.traders.length === 0) { + return ( +
+ {/* Competition Header - 精简版 */} +
+
+
+ +
+
+

+ {t('aiCompetition', language)} + + 0 {t('traders', language)} + +

+

+ {t('liveBattle', language)} +

+
+
+
+ + {/* Empty State */} +
+ +

+ {t('noTraders', language)} +

+

+ {t('createFirstTrader', language)} +

+
+
+ ); + } + // 按收益率排序 const sortedTraders = [...competition.traders].sort( (a, b) => b.total_pnl_pct - a.total_pnl_pct diff --git a/web/src/components/EquityChart.tsx b/web/src/components/EquityChart.tsx index bfa89617..e7441779 100644 --- a/web/src/components/EquityChart.tsx +++ b/web/src/components/EquityChart.tsx @@ -270,7 +270,23 @@ export function EquityChart({ traderId }: EquityChartProps) {
{/* Chart */} -
+
+ {/* NOFX Watermark */} +
+ NOFX +