"use client" import React, { useEffect, useState } from 'react' import AutoTradingPanel from './AutoTradingPanel' import TradingHistory from './TradingHistory' import DeveloperSettings from './DeveloperSettings' export default function Dashboard() { const [positions, setPositions] = useState([]) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { async function fetchPositions() { try { const res = await fetch('/api/trading') if (res.ok) { const data = await res.json() setPositions(data.positions || []) } else { setError('Failed to load positions') } } catch (e) { setError('Error loading positions') } setLoading(false) } fetchPositions() }, []) return (

Open Positions

{loading ?
Loading...
: error ?
{error}
: ( {positions.map((pos, i) => ( ))}
Symbol Side Size Entry Price Unrealized PnL
{pos.symbol} {pos.side} {pos.size} {pos.entryPrice} {pos.unrealizedPnl}
)}
) }