import { getPnLData } from '@/lib/queries';
import { PnLClient } from './PnLClient';
function MetricCard({
label,
value,
color = 'text-white',
}: {
label: string;
value: string;
color?: string;
}) {
return (
);
}
export const dynamic = 'force-dynamic';
export default async function PnLPage() {
const { data, metrics } = await getPnLData();
return (
Profit & Loss
Performance metrics and PnL tracking
{/* Metrics Row */}
= 0 ? 'text-green-400' : 'text-red-400'}
/>
0 ? `${(metrics.winRate * 100).toFixed(1)}%` : '—'}
color="text-blue-400"
/>
0 ? metrics.sharpe.toFixed(2) : '—'}
color={metrics.sharpe > 1 ? 'text-green-400' : 'text-yellow-400'}
/>
0 ? `$${metrics.maxDrawdown.toFixed(2)}` : '—'}
color="text-red-400"
/>
{/* Trade Stats */}
Total Trades
{metrics.totalTrades}
Winning Trades
{metrics.winningTrades}
{/* Charts */}
{data.length > 0 ? (
) : (
No PnL data yet. Metrics will appear after the bot completes trades.
)}
);
}