mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-17 14:01:02 +00:00
Fix: normalize live trade PnL cents/dollars
This commit is contained in:
@@ -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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user