const http = require('http');

http.get('http://localhost:5000/api/status', (res) => {
    let data = '';
    res.on('data', (chunk) => { data += chunk; });
    res.on('end', () => {
        try {
            const botState = JSON.parse(data);
            console.log('--- LIVE BOT ANALYSIS STATUS ---');
            Object.entries(botState.symbols).forEach(([symbol, details]) => {
                console.log(`📍 ${symbol}: Signal=${details.signal}`);
                Object.entries(details.rules).forEach(([rule, res]) => {
                    const statusIcon = res.passed ? '✅' : '❌';
                    console.log(`   ${statusIcon} ${rule}: ${res.reason}`);
                });
            });
        } catch (e) {
            console.error('Error parsing JSON:', e.message);
        }
    });
}).on('error', (err) => {
    console.error('Error fetching status:', err.message);
});
