From eb2e6b579a4d5c3395eccc75fca53d85546c0cdd Mon Sep 17 00:00:00 2001 From: Thigazhezhilan J Date: Tue, 7 Apr 2026 09:37:01 +0530 Subject: [PATCH] Fix live portfolio value calculation --- src/components/landing/PortfolioSection.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/landing/PortfolioSection.tsx b/src/components/landing/PortfolioSection.tsx index 1502bfea..d7051951 100644 --- a/src/components/landing/PortfolioSection.tsx +++ b/src/components/landing/PortfolioSection.tsx @@ -203,7 +203,11 @@ function getDisplayPnl(item: any) { } function getHoldingValue(item: any) { - return firstNumber(item?.holding_value, getEffectiveQuantity(item) * getLastPrice(item)); + const brokerValue = Number(item?.holding_value); + if (Number.isFinite(brokerValue) && brokerValue >= 0) { + return brokerValue; + } + return Math.abs(getEffectiveQuantity(item)) * Math.abs(getLastPrice(item)); } function getPortfolioItemKey(item: any, idx: number) {