import axios from 'axios'; async function finalVerify() { try { console.log("šŸ” COMPREHENSIVE SYSTEM VERIFICATION šŸ”"); // 1. Check API Heartbeat const statusRes = await axios.get('http://localhost:5000/api/status'); const state = statusRes.data; console.log(`āœ… Backend API: Active (Uptime: ${(state.uptime / 60000).toFixed(2)} mins)`); // 2. Verify Symbols & Rule Engines const symbols = Object.keys(state.symbols); console.log(`āœ… Monitored Symbols: ${symbols.join(', ')}`); symbols.forEach(s => { const sym = state.symbols[s]; const rulesPassed = Object.values(sym.rules).filter((r: any) => r.passed).length; const rulesTotal = Object.keys(sym.rules).length; console.log(` šŸ”ø ${s}: Rules ${rulesPassed}/${rulesTotal} Passing | Last Signal: ${sym.signal}`); }); // 3. Verify Profiles & Global Config console.log('\n--- šŸ›  INFRASTRUCTURE CHECK ---'); try { const configRes = await axios.get('http://localhost:5000/api/config'); console.log(`āœ… Config Engine: Providing synchronized parameters to all clusters.`); console.log(` Master Symbols: ${configRes.data.SYMBOLS.join(', ')}`); } catch (e) { console.log("āŒ Config Endpoint unreachable."); } // 4. Signal Alert Propagation console.log('\n--- šŸ“” SIGNAL PROPAGATION ---'); if (state.alerts.length > 0) { const latestSignal = state.alerts.filter((a: any) => a.type === 'signal').pop(); if (latestSignal) { console.log(`āœ… Recent Signal Found: ${latestSignal.symbol} at ${new Date(latestSignal.timestamp).toLocaleTimeString()}`); console.log(` Message snippet: ${latestSignal.message.substring(0, 50)}...`); } else { console.log("ā„¹ļø No recent 'BUY/SELL' signals detected in the current buffer."); } } console.log('\n--- šŸ’° ACTIVE AUTO-TRADING ---'); if (state.positions.length > 0) { console.log(`šŸ”„ ALERT: Active Auto-Trades detected!`); state.positions.forEach((p: any) => { console.log(` šŸ“ [${p.symbol}] ${p.side} | Profile: ${p.profileId || 'System'} | PnL: ${p.unrealizedPnlPercent?.toFixed(2)}%`); }); } else { console.log("ā„¹ļø Engine IDLE: Waiting for 100% rule alignment for execution."); } console.log("\nšŸš€ VERIFICATION COMPLETE: System architecture is healthy and reactive."); } catch (err: any) { console.error('āŒ CRITICAL: Failed to communicate with Bot Engine.', err.message); } } finalVerify();