#!/usr/bin/env node // Test the enhanced anti-chasing AI system async function testAntiChasingAI() { console.log('๐Ÿงช TESTING ENHANCED ANTI-CHASING AI SYSTEM'); console.log('='.repeat(50)); try { // Test if the enhanced AI analysis endpoint is working console.log('1๏ธโƒฃ Testing enhanced AI analysis endpoint...'); const testConfig = { symbol: 'SOLUSD', timeframe: '60', // 1 hour - good for testing layouts: ['ai'], analyze: true, antiChasing: true // Enable anti-chasing protection }; console.log('๐Ÿ“Š Test configuration:', JSON.stringify(testConfig, null, 2)); console.log('โณ This will take 30-60 seconds for real analysis...'); const response = await fetch('http://localhost:9001/api/enhanced-screenshot', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(testConfig), timeout: 120000 // 2 minute timeout }); if (response.ok) { const result = await response.json(); console.log('โœ… Enhanced AI system is working!'); if (result.analysis) { console.log('\n๐Ÿ“ˆ AI Analysis Preview:'); console.log(` Confidence: ${result.analysis.confidence}%`); console.log(` Recommendation: ${result.analysis.recommendation}`); console.log(` Anti-chasing active: ${result.analysis.antiChasing ? 'Yes' : 'No'}`); if (result.analysis.reasoning) { console.log(` Reasoning: ${result.analysis.reasoning.substring(0, 200)}...`); } // Check for anti-chasing keywords in reasoning const reasoning = result.analysis.reasoning || ''; const antiChasingKeywords = [ 'momentum exhaustion', 'reversal', 'overextended', 'exhausted', 'anti-chasing', 'not chasing' ]; const hasAntiChasingLogic = antiChasingKeywords.some(keyword => reasoning.toLowerCase().includes(keyword) ); if (hasAntiChasingLogic) { console.log('๐Ÿ›ก๏ธ CONFIRMED: Anti-chasing logic detected in AI reasoning'); } else { console.log('โš ๏ธ NOTE: May need to check if anti-chasing logic is active'); } } console.log('\nโœ… SYSTEM STATUS: Ready for paper trading'); console.log('๐ŸŽฏ Next step: Go to paper trading page and start first analysis'); } else { console.log(`โŒ API Error: ${response.status} ${response.statusText}`); console.log('๐Ÿ’ก The system may still be starting up'); console.log('๐Ÿ”„ Try running a manual analysis in the paper trading page'); } } catch (error) { console.log(`โŒ Connection Error: ${error.message}`); console.log('๐Ÿ’ก System may still be initializing after restart'); console.log('๐Ÿ”„ Try the paper trading page directly: http://localhost:9001/paper-trading'); } console.log('\n๐ŸŽ“ PAPER TRADING QUICK START:'); console.log(' 1. Open: http://localhost:9001/paper-trading'); console.log(' 2. Select 1H timeframe (most reliable)'); console.log(' 3. Choose SOLUSD symbol'); console.log(' 4. Click "๐Ÿ›ก๏ธ Run Enhanced Analysis"'); console.log(' 5. Review the AI reasoning for anti-chasing logic'); console.log(' 6. Execute paper trade if confident'); console.log(' 7. Let the AI learn from the outcome'); console.log('\n๐Ÿ’ก WHAT TO LOOK FOR IN AI ANALYSIS:'); console.log(' โœ… "Momentum exhaustion detected"'); console.log(' โœ… "Waiting for reversal confirmation"'); console.log(' โœ… "Not chasing the current move"'); console.log(' โœ… Multi-timeframe validation mentioned'); console.log(' โŒ Avoid: "Following momentum" or "Trend continuation"'); } testAntiChasingAI().catch(console.error);