From 1ae1f90d8a0e988121adbd3acc9e76a948021593 Mon Sep 17 00:00:00 2001 From: icy Date: Tue, 4 Nov 2025 00:16:14 +0800 Subject: [PATCH] Limit performance comparison chart to top 5 traders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend changes to ensure equity-history-batch API only requests data for top 5 performers: - Modify CompetitionPage to pass only top 5 traders to ComparisonChart component - Update API comments to reflect the change from top 10 to top 5 - Optimize chart performance by reducing data volume and API calls This ensures the performance comparison chart shows only the most relevant traders while improving load times. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- web/src/components/AITradersPage.tsx | 8 ++++---- web/src/components/CompetitionPage.tsx | 2 +- web/src/lib/api.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/components/AITradersPage.tsx b/web/src/components/AITradersPage.tsx index 41b3cdc2..6965d8f8 100644 --- a/web/src/components/AITradersPage.tsx +++ b/web/src/components/AITradersPage.tsx @@ -182,8 +182,8 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) { if (!editingTrader) return; try { - const model = enabledModels?.find(m => m.id === data.ai_model_id); - const exchange = enabledExchanges?.find(e => e.id === data.exchange_id); + const model = allModels?.find(m => m.id === data.ai_model_id); + const exchange = allExchanges?.find(e => e.id === data.exchange_id); if (!model) { alert(t('modelConfigNotExist', language)); @@ -782,8 +782,8 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) { isOpen={showEditModal} isEditMode={true} traderData={editingTrader} - availableModels={enabledModels} - availableExchanges={enabledExchanges} + availableModels={allModels} + availableExchanges={allExchanges} onSave={handleSaveEditTrader} onClose={() => { setShowEditModal(false); diff --git a/web/src/components/CompetitionPage.tsx b/web/src/components/CompetitionPage.tsx index b123a75b..3168bd14 100644 --- a/web/src/components/CompetitionPage.tsx +++ b/web/src/components/CompetitionPage.tsx @@ -116,7 +116,7 @@ export function CompetitionPage() { {t('realTimePnL', language)} - + {/* Right: Leaderboard */} diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 607f4be6..0e066dce 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -260,10 +260,10 @@ export const api = { return res.json(); }, - // 获取前10名交易员数据(无需认证) + // 获取前5名交易员数据(无需认证) async getTopTraders(): Promise { const res = await fetch(`${API_BASE}/top-traders`); - if (!res.ok) throw new Error('获取前10名交易员失败'); + if (!res.ok) throw new Error('获取前5名交易员失败'); return res.json(); },