Fix: normalize live trade PnL cents/dollars

This commit is contained in:
2026-03-16 14:51:58 -07:00
parent 0cb4a082b1
commit 076480d05d

View File

@@ -296,7 +296,12 @@ function MarketCard({ market }) {
function LiveOrderRow({ order, isOpen }) { function LiveOrderRow({ order, isOpen }) {
const won = order.result && order.side?.toLowerCase() === order.result?.toLowerCase(); const won = order.result && order.side?.toLowerCase() === order.result?.toLowerCase();
const isNeutral = order.result === 'cancelled' || order.result === 'expired'; const isNeutral = order.result === 'cancelled' || order.result === 'expired';
const pnlVal = order.pnl != null ? (typeof order.pnl === 'number' && Math.abs(order.pnl) > 50 ? order.pnl / 100 : order.pnl) : null;
const rawPnl = order?.pnl != null ? Number(order.pnl) : null;
const pnlVal = Number.isFinite(rawPnl)
? (Number.isInteger(rawPnl) ? rawPnl / 100 : rawPnl)
: null;
const pnlColor = pnlVal == null ? 'text-gray-600' : pnlVal > 0 ? 'text-green-400' : pnlVal < 0 ? 'text-red-400' : 'text-gray-400'; const pnlColor = pnlVal == null ? 'text-gray-600' : pnlVal > 0 ? 'text-green-400' : pnlVal < 0 ? 'text-red-400' : 'text-gray-400';
return ( return (