diff --git a/lib/simple-automation.js b/lib/simple-automation.js index e775a24..d9bc825 100644 --- a/lib/simple-automation.js +++ b/lib/simple-automation.js @@ -42,6 +42,9 @@ class SimpleAutomation { this.isRunning = true; this.stats.startTime = new Date().toISOString(); this.stats.status = 'Running'; + + console.log('✅ AUTOMATION STATUS: isRunning =', this.isRunning); + console.log('đŸŽ¯ LIVE TRADING:', this.config.enableTrading ? 'ENABLED' : 'DISABLED'); this.stats.totalCycles = 0; // Auto-enable trading when in LIVE mode @@ -94,8 +97,10 @@ class SimpleAutomation { async stop() { try { + console.log('🛑 STOPPING AUTOMATION...'); this.isRunning = false; this.stats.status = 'Stopped'; + console.log('✅ AUTOMATION STATUS: isRunning =', this.isRunning); if (this.intervalId) { clearInterval(this.intervalId); @@ -113,6 +118,12 @@ class SimpleAutomation { async runCycle() { try { + // Check if automation should still be running + if (!this.isRunning) { + console.log('âšī¸ AUTOMATION STOPPED: Skipping cycle'); + return; + } + this.stats.totalCycles++; this.stats.lastActivity = new Date().toISOString(); @@ -469,7 +480,7 @@ class SimpleAutomation { } getStatus() { - return { + const baseStatus = { isActive: this.isRunning, mode: this.config?.mode || 'SIMULATION', enableTrading: this.config?.enableTrading || false, @@ -479,6 +490,17 @@ class SimpleAutomation { automationType: 'SIMPLE', ...this.stats }; + + // Add more descriptive status based on running state + if (this.isRunning) { + baseStatus.detailedStatus = 'Running - Monitoring for trade opportunities'; + baseStatus.nextAction = 'Next analysis cycle in progress'; + } else { + baseStatus.detailedStatus = 'Stopped - No monitoring active'; + baseStatus.nextAction = 'Start automation to begin monitoring'; + } + + return baseStatus; } }