import React from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, LineChart, Line, PieChart, Pie, Cell } from 'recharts'; import { TrendingUp, TrendingDown, Activity, Target, DollarSign, Percent } from 'lucide-react'; // Mock data for demonstration const performanceData = [ { date: '2024-01-01', profit: 120, loss: -30, trades: 8 }, { date: '2024-01-02', profit: 85, loss: -45, trades: 12 }, { date: '2024-01-03', profit: 95, loss: -20, trades: 6 }, { date: '2024-01-04', profit: 140, loss: -60, trades: 15 }, { date: '2024-01-05', profit: 110, loss: -25, trades: 9 }, { date: '2024-01-06', profit: 165, loss: -40, trades: 11 }, { date: '2024-01-07', profit: 190, loss: -55, trades: 14 } ]; const portfolioData = [ { name: 'SOL', value: 45, color: '#00D4AA' }, { name: 'USDC', value: 30, color: '#3B82F6' }, { name: 'RAY', value: 15, color: '#8B5CF6' }, { name: 'Others', value: 10, color: '#F59E0B' } ]; const tradingPairs = [ { pair: 'SOL/USDC', trades: 24, pnl: 340.50, winRate: 75 }, { pair: 'RAY/SOL', trades: 18, pnl: -125.30, winRate: 44 }, { pair: 'ORCA/USDC', trades: 12, pnl: 89.20, winRate: 67 }, { pair: 'BONK/SOL', trades: 8, pnl: 156.80, winRate: 88 } ]; export const PerformanceTracker: React.FC = () => { const totalPnL = performanceData.reduce((acc, day) => acc + day.profit + day.loss, 0); const totalTrades = performanceData.reduce((acc, day) => acc + day.trades, 0); const winningTrades = Math.floor(totalTrades * 0.685); // 68.5% win rate return (
{/* Performance Overview */}
Daily P&L Trend new Date(value).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })} /> Portfolio Allocation {portfolioData.map((entry, index) => ( ))}
{portfolioData.map((item) => (
{item.name} {item.value}%
))}
{/* Trading Pairs Performance */} Trading Pairs Performance
{tradingPairs.map((pair, index) => (
{pair.pair}
{pair.trades} trades
= 0 ? 'text-profit' : 'text-loss'}`}> {pair.pnl >= 0 ? '+' : ''}${pair.pnl.toFixed(2)}
P&L
= 60 ? 'text-profit' : pair.winRate >= 40 ? 'text-warning' : 'text-loss'}`}> {pair.winRate}%
Win Rate
))}
{/* Summary Stats */}

Total P&L

= 0 ? 'text-profit' : 'text-loss'}`}> {totalPnL >= 0 ? '+' : ''}${totalPnL.toFixed(2)}

Total Trades

{totalTrades}

Winning Trades

{winningTrades}

Win Rate

68.5%

); };