diff --git a/web/src/tabs/PositionsTab.tsx b/web/src/tabs/PositionsTab.tsx index 60077b4..8791057 100644 --- a/web/src/tabs/PositionsTab.tsx +++ b/web/src/tabs/PositionsTab.tsx @@ -1296,19 +1296,22 @@ export const PositionsTab = ({ botState }: PositionsTabProps) => { const hasCurrentPrice = hasFiniteNumber(pos.currentPrice); const hasPnl = hasFiniteNumber(pos.pnl); const hasPnlPercent = hasFiniteNumber(pos.pnlPercent); + const currentPrice: number | null = hasCurrentPrice ? Number(pos.currentPrice) : null; + const pnl: number | null = hasPnl ? Number(pos.pnl) : null; + const pnlPercent: number | null = hasPnlPercent ? Number(pos.pnlPercent) : null; const displayStopLoss = (pos.stopLoss && pos.stopLoss > 0) ? pos.stopLoss : (entryRisk?.stopLoss || 0); const displayTakeProfit = (pos.takeProfit && pos.takeProfit > 0) ? pos.takeProfit : (entryRisk?.takeProfit || 0); - const slBreached = hasCurrentPrice && displayStopLoss > 0 && ( - (pos.side === 'BUY' && pos.currentPrice <= displayStopLoss) - || (pos.side === 'SELL' && pos.currentPrice >= displayStopLoss) + const slBreached = currentPrice !== null && displayStopLoss > 0 && ( + (pos.side === 'BUY' && currentPrice <= displayStopLoss) + || (pos.side === 'SELL' && currentPrice >= displayStopLoss) ); - const tpHit = hasCurrentPrice && displayTakeProfit > 0 && ( - (pos.side === 'BUY' && pos.currentPrice >= displayTakeProfit) - || (pos.side === 'SELL' && pos.currentPrice <= displayTakeProfit) + const tpHit = currentPrice !== null && displayTakeProfit > 0 && ( + (pos.side === 'BUY' && currentPrice >= displayTakeProfit) + || (pos.side === 'SELL' && currentPrice <= displayTakeProfit) ); return ( @@ -1342,7 +1345,7 @@ export const PositionsTab = ({ botState }: PositionsTabProps) => {