import type { Order } from "../lib/alpaca"; import { money, num, timeAgo } from "../lib/format"; function statusTone(status: string): string { const s = status.toLowerCase(); if (["filled", "done_for_day"].includes(s)) return "text-up"; if (["canceled", "rejected", "expired"].includes(s)) return "text-down"; if (["new", "accepted", "pending_new", "held", "open"].includes(s)) return "text-warn"; return "text-mute"; } export function OrdersTable({ orders }: { orders: Order[] }) { if (!orders.length) return
| Submitted | Symbol | Side | Type | Qty | Limit / Trail | Filled | Status |
|---|---|---|---|---|---|---|---|
| {timeAgo(o.submitted_at)} | {o.symbol} | {o.side} | {o.order_type} | {num(o.qty, 0)} | {o.limit_price ? money(o.limit_price) : o.trail_percent ? `${Number(o.trail_percent).toFixed(2)}%` : "—"} | {o.filled_avg_price ? money(o.filled_avg_price) : "—"} | {o.status} |