diff --git a/src/routes/stocks/[tickerID]/forecast/analyst/+page.svelte b/src/routes/stocks/[tickerID]/forecast/analyst/+page.svelte index 2cd62233..0cc5cde2 100644 --- a/src/routes/stocks/[tickerID]/forecast/analyst/+page.svelte +++ b/src/routes/stocks/[tickerID]/forecast/analyst/+page.svelte @@ -42,8 +42,14 @@ : "-"; consensusRating = analystRating?.consensusRating; changesPercentage = - analystRating?.priceTarget !== ("n/a" && 0) - ? ((priceTarget / data?.getStockQuote?.price - 1) * 100)?.toFixed(2) + analystRating?.medianPriceTarget !== "n/a" && + analystRating?.medianPriceTarget !== null && + analystRating?.medianPriceTarget !== undefined && + data?.getStockQuote?.price !== null + ? ( + (analystRating.medianPriceTarget / data.getStockQuote.price - 1) * + 100 + )?.toFixed(2) : "-"; } if (activeIdx === 1) { @@ -220,7 +226,9 @@
- ${priceTarget} + {priceTarget !== null && priceTarget !== undefined + ? "$" + priceTarget + : "n/a"}
- {changesPercentage}% + {changesPercentage}