import type { Position } from "@/lib/mt5"; import { formatCurrency } from "@/lib/format"; export default function PositionsTable({ positions, currency = "USD" }: { positions: Position[]; currency?: string; }) { return ( {["Symbol", "Side", "Volume", "Entry", "Current", "SL", "TP", "P&L"].map(h => ( ))} {positions.map((p) => { const isBuy = p.type === 0; return ( ); })}
{h}
{p.symbol} {isBuy ? "BUY" : "SELL"} {p.volume} {p.price_open.toFixed(2)} {p.price_current.toFixed(2)} {p.sl > 0 ? p.sl.toFixed(2) : "—"} {p.tp > 0 ? p.tp.toFixed(2) : "—"} = 0 ? "text-bull" : "text-bear"}`}> {formatCurrency(p.profit, currency)}
); }