mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-07 03:07:56 +08:00
Fix ComparisonChart data display issue
The chart was not showing data because the API response format changed. Fixed the calculation of PnL percentage by computing it from total_pnl and balance values (initial_balance = balance - total_pnl). Now the AI competition chart should properly display performance comparison data. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user