"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())) } } return (

Auto-Trading Control

Status: {status}
{message &&
{message}
}
) }