'use client' import React, { useState, useEffect } from 'react' export default function AutomationPage() { const [config, setConfig] = useState({ mode: 'SIMULATION', dexProvider: 'DRIFT', // Only Drift now symbol: 'SOLUSD', timeframe: '1h', tradingAmount: 100, maxLeverage: 5, stopLossPercent: 2, takeProfitPercent: 6, maxDailyTrades: 5, riskPercentage: 2 }) const [status, setStatus] = useState(null) const [isLoading, setIsLoading] = useState(false) const [recentTrades, setRecentTrades] = useState([]) useEffect(() => { fetchStatus() const interval = setInterval(fetchStatus, 30000) return () => clearInterval(interval) }, []) const fetchStatus = async () => { try { const response = await fetch('/api/automation/status') const data = await response.json() if (data.success) { setStatus(data.status) } } catch (error) { console.error('Failed to fetch status:', error) } } const handleStart = async () => { setIsLoading(true) try { const response = await fetch('/api/automation/start', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) }) const data = await response.json() if (data.success) { fetchStatus() } else { alert('Failed to start automation: ' + data.error) } } catch (error) { console.error('Failed to start automation:', error) alert('Failed to start automation') } finally { setIsLoading(false) } } const handleStop = async () => { setIsLoading(true) try { const response = await fetch('/api/automation/stop', { method: 'POST' }) const data = await response.json() if (data.success) { fetchStatus() } else { alert('Failed to stop automation: ' + data.error) } } catch (error) { console.error('Failed to stop automation:', error) alert('Failed to stop automation') } finally { setIsLoading(false) } } return (
AI-powered automated trading • Up to 100x leverage • Perpetual futures
🚀 Up to 100x Leverage • 💎 Perpetual Futures • 💰 Spot Trading (1x) • 🎯 Advanced Risk Management
{config.maxLeverage === 1 && "✅ Spot trading - No liquidation risk"} {config.maxLeverage <= 5 && config.maxLeverage > 1 && "🟢 Conservative leverage - Lower risk"} {config.maxLeverage <= 10 && config.maxLeverage > 5 && "🟡 Moderate leverage - Balanced risk/reward"} {config.maxLeverage <= 50 && config.maxLeverage > 10 && "🟠 High leverage - Significant risk"} {config.maxLeverage > 50 && "🔴 EXTREME LEVERAGE - Maximum risk! Use with caution!"}
You selected {config.maxLeverage}x leverage. This multiplies both profits AND losses. A {(100/config.maxLeverage).toFixed(1)}% price move against your position will result in liquidation. Only use high leverage if you understand the risks!
Loading status...
)}High leverage trading carries substantial risk of loss. Never trade with money you cannot afford to lose. Past performance does not guarantee future results.