import React, { useState, useEffect } from 'react'; import { motion } from 'framer-motion'; import { TrendingUp, Activity, DollarSign, Target } from 'lucide-react'; const ModelPerformance = () => { const [metrics, setMetrics] = useState(null); useEffect(() => { const fetchPnL = async () => { try { const res = await fetch(`${import.meta.env.VITE_API_URL}/api/pnl`); const data = await res.json(); setMetrics(data); } catch (e) { console.error("PnL fetch error", e); } }; fetchPnL(); const interval = setInterval(fetchPnL, 5000); // Live updates return () => clearInterval(interval); }, []); if (!metrics) return
; return (

Model Track Record

Live P&L Simulation

Total P&L
= 0 ? 'text-emerald-400' : 'text-rose-400'}`}> {metrics.total_pnl >= 0 ? '+' : ''}${metrics.total_pnl.toLocaleString(undefined, { maximumFractionDigits: 0 })}
ROI
= 0 ? 'text-emerald-400' : 'text-rose-400'}`}> {metrics.roi_pct >= 0 ? '+' : ''}{metrics.roi_pct}%
Win Rate {metrics.win_rate}%
Avg Win +{metrics.avg_win_pct}%
Avg Loss {metrics.avg_loss_pct}%
Active Positions: {metrics.active_positions} Total Trades: {metrics.total_trades}
); }; export default ModelPerformance;