diff --git a/app/automation-v2/page.js b/app/automation-v2/page.js index d7ec816..a0f8792 100644 --- a/app/automation-v2/page.js +++ b/app/automation-v2/page.js @@ -176,9 +176,12 @@ Based on comprehensive technical analysis across multiple timeframes: const handleStart = async () => { console.log('🚀 Starting automation...') setLoading(true) + setActionFeedback({ type: 'info', message: 'Starting Money Printing Machine...' }) + try { if (config.selectedTimeframes.length === 0) { console.error('No timeframes selected') + setActionFeedback({ type: 'error', message: 'Please select at least one timeframe' }) setLoading(false) return } @@ -193,25 +196,51 @@ Based on comprehensive technical analysis across multiple timeframes: takeProfit: config.takeProfit } + console.log('📤 Sending config:', automationConfig) + + // Set a longer timeout for the API call + const controller = new AbortController() + const timeoutId = setTimeout(() => controller.abort(), 30000) // 30 second timeout + const response = await fetch('/api/automation/start', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(automationConfig) + body: JSON.stringify(automationConfig), + signal: controller.signal }) + clearTimeout(timeoutId) + + if (!response.ok) { + throw new Error(`API Error: ${response.status} ${response.statusText}`) + } + const data = await response.json() if (data.success) { - console.log('✅ Automation started successfully') + console.log('✅ Automation started successfully:', data) + setActionFeedback({ type: 'success', message: '✅ Money Printing Machine ACTIVATED! System is now trading autonomously.' }) if (data.learningSystem?.integrated) { console.log('🧠 AI Learning System: Activated') } - fetchStatus() + // Refresh status after a short delay + setTimeout(() => { + fetchStatus() + fetchLiveDecisions() + }, 2000) + // Clear success message after 5 seconds + setTimeout(() => setActionFeedback(null), 5000) } else { console.error('Failed to start automation:', data.error) + setActionFeedback({ type: 'error', message: `Failed to start: ${data.error || 'Unknown error'}` }) } } catch (error) { console.error('Failed to start automation:', error) + if (error.name === 'AbortError') { + setActionFeedback({ type: 'error', message: 'Start request timed out. Please try again.' }) + } else { + setActionFeedback({ type: 'error', message: `Error: ${error.message}` }) + } } finally { setLoading(false) } @@ -510,12 +539,12 @@ Based on comprehensive technical analysis across multiple timeframes: {loading ? (
- Starting... + Starting Money Printing Machine...
) : (
{status?.rateLimitHit ? '🔄' : '🚀'} - {status?.rateLimitHit ? 'RESTART' : 'START'} + {status?.rateLimitHit ? 'RESTART MPM' : 'START MONEY PRINTING MACHINE'}
)} diff --git a/prisma/prisma/dev.db b/prisma/prisma/dev.db index fbdd063..7735022 100644 Binary files a/prisma/prisma/dev.db and b/prisma/prisma/dev.db differ