'use client' import { useEffect, useState } from 'react' interface ClusterStatus { cluster: { totalCores: number activeCores: number cpuUsage: number activeWorkers: number totalWorkers: number workerProcesses: number status: string } workers: Array<{ name: string host: string cpuUsage: number loadAverage: string activeProcesses: number status: string }> exploration: { totalCombinations: number combinationsPerChunk: number totalChunks: number chunksCompleted: number currentChunk: string progress: number } topStrategies: Array<{ rank: number pnl_per_1k: number win_rate: number trades: number profit_factor: number max_drawdown: number params: { flip_threshold: number ma_gap: number adx_min: number long_pos_max: number short_pos_min: number } }> recommendation: string lastUpdate: string } export default function ClusterPage() { const [status, setStatus] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) const fetchStatus = async () => { try { const res = await fetch('/api/cluster/status') if (!res.ok) throw new Error('Failed to fetch') const data = await res.json() setStatus(data) setError(null) } catch (err: any) { setError(err.message) } finally { setLoading(false) } } useEffect(() => { fetchStatus() const interval = setInterval(fetchStatus, 30000) // Refresh every 30s return () => clearInterval(interval) }, []) if (loading) { return (

🖥️ EPYC Cluster Status

Loading cluster status...
) } if (error) { return (

🖥️ EPYC Cluster Status

Error: {error}

) } if (!status) return null const getStatusColor = (statusStr: string) => { if (statusStr === 'active') return 'text-green-400' if (statusStr === 'idle') return 'text-yellow-400' return 'text-red-400' } const getStatusBg = (statusStr: string) => { if (statusStr === 'active') return 'bg-green-900/20 border-green-500' if (statusStr === 'idle') return 'bg-yellow-900/20 border-yellow-500' return 'bg-red-900/20 border-red-500' } return (
{/* Back Button */} Back to Dashboard

🖥️ EPYC Cluster Status

{/* Cluster Overview */}

Cluster Overview

Status
{status.cluster.status.toUpperCase()}
CPU Usage
{status.cluster.cpuUsage.toFixed(1)}%
Active Cores
{status.cluster.activeCores} / {status.cluster.totalCores}
Workers
{status.cluster.activeWorkers} / {status.cluster.totalWorkers}
{/* Worker Details */}
{status.workers.map((worker) => (

{worker.name}

{worker.host}
CPU: {worker.cpuUsage.toFixed(1)}%
Load: {worker.loadAverage}
Processes: {worker.activeProcesses}
))}
{/* Exploration Progress */}

📊 Parameter Exploration

Total Space
{status.exploration.totalCombinations.toLocaleString()}
Chunks Completed
{status.exploration.chunksCompleted} / {status.exploration.totalChunks}
Current Chunk
{status.exploration.currentChunk}
{(status.exploration.progress * 100).toFixed(2)}% complete
{/* Recommendation */} {status.recommendation && (

🎯 AI Recommendation

{status.recommendation}
)} {/* Top Strategies */} {status.topStrategies.length > 0 && (

🏆 Top Strategies

{status.topStrategies.map((strategy) => (
#{strategy.rank}
${strategy.pnl_per_1k.toFixed(2)}
per $1k
Win Rate:{' '} {(strategy.win_rate * 100).toFixed(1)}%
Trades:{' '} {strategy.trades}
PF:{' '} {strategy.profit_factor.toFixed(2)}x
Max DD:{' '} ${Math.abs(strategy.max_drawdown).toFixed(0)}
Show Parameters
flip: {strategy.params.flip_threshold}
ma_gap: {strategy.params.ma_gap}
adx: {strategy.params.adx_min}
long_pos: {strategy.params.long_pos_max}
short_pos: {strategy.params.short_pos_min}
))}
)}
Last updated: {new Date(status.lastUpdate).toLocaleString()}
) }