import { Kpi } from "./components/kpi"; import { EquityChart, type EquityPoint } from "./components/equity-chart"; import { PositionsTable } from "./components/positions-table"; import { OrdersTable } from "./components/orders-table"; import { IntentsTable } from "./components/intents-table"; import { dbStatus, recentIntents, recentTicks } from "./lib/db"; import { credentialsPresent, getAccount, getClock, getOrders, getPositions, } from "./lib/alpaca"; import { money, pct } from "./lib/format"; export const dynamic = "force-dynamic"; export const revalidate = 0; export default async function Page() { const [account, positions, orders, clock] = await Promise.all([ getAccount(), getPositions(), getOrders(), getClock(), ]); const ticks = recentTicks(300).reverse(); const intents = recentIntents(200); const db = dbStatus(); const chartData: EquityPoint[] = ticks .filter((t) => t.equity !== null) .map((t) => ({ ts: String(t.ts), equity: Number(t.equity || 0), cash: Number(t.cash || 0), })); const equity = Number(account?.equity || 0); const lastEquity = Number(account?.last_equity || equity); const dayPL = equity - lastEquity; const dayPct = lastEquity ? dayPL / lastEquity : 0; const creds = credentialsPresent(); return (

alpaclaudia.

Alpaca paper-trading bot — Wheel + trailing stops.

{creds ? ( ● Alpaca connected ) : ( ● No Alpaca creds )} {clock && ( market {clock.is_open ? "open" : "closed"} )} {db.ok ? ( db ok ) : ( db missing )}
0 ? "up" : dayPL < 0 ? "down" : "mute"} /> p.asset_class?.toLowerCase().includes("option")).length} option · ${ (positions || []).filter((p) => !p.asset_class?.toLowerCase().includes("option")).length } equity`} />
); }