"use client" import React, { useState } from 'react' export default function AutoTradingPanel() { const [status, setStatus] = useState<'idle'|'running'|'stopped'>('idle') const [message, setMessage] = useState('') async function handleAction(action: 'start'|'stop') { setMessage('') setStatus('idle') const res = await fetch('/api/auto-trading', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action }) }) if (res.ok) { setStatus(action === 'start' ? 'running' : 'stopped') setMessage(`Auto-trading ${action}ed`) } else { setMessage('Error: ' + (await res.text())) } } const getStatusColor = () => { switch (status) { case 'running': return 'text-green-400' case 'stopped': return 'text-red-400' default: return 'text-gray-400' } } const getStatusIcon = () => { switch (status) { case 'running': return '🟢' case 'stopped': return '🔴' default: return '⚫' } } return (

Auto-Trading Control

{getStatusIcon()} {status}
{/* Status Display */}

Trading Status

{status === 'running' ? 'ACTIVE' : status === 'stopped' ? 'STOPPED' : 'IDLE'}

Last Updated
{new Date().toLocaleTimeString()}
{message && (
{message}
)}
{/* Action Buttons */}
{/* Trading Metrics (Mock Data) */}
Today's Trades
12
Success Rate
85%
) }