diff --git a/src/routes/stocks/[tickerID]/forecast/+page.svelte b/src/routes/stocks/[tickerID]/forecast/+page.svelte index c8e42916..a18f2bf7 100644 --- a/src/routes/stocks/[tickerID]/forecast/+page.svelte +++ b/src/routes/stocks/[tickerID]/forecast/+page.svelte @@ -19,9 +19,9 @@ let index = 0; let changeRevenue = 0; - let changeNetIncome = 0; - let changeEBITDA = 0; + let changeRevenueNextYear = 0; let changeEPS = 0; + let changeEPSNextYear = 0; const price = data?.getStockQuote?.price?.toFixed(2) || 0; @@ -262,21 +262,28 @@ const estimatedRevenueAvg = data?.getAnalystEstimate[index - 1]?.estimatedRevenueAvg; const revenue = data?.getAnalystEstimate[index - 2]?.revenue; - const estimatedNetIncomeAvg = - data?.getAnalystEstimate[index - 1]?.estimatedNetIncomeAvg; - const netIncome = data?.getAnalystEstimate[index - 2]?.netIncome; - const estimatedEbitdaAvg = - data?.getAnalystEstimate[index - 1]?.estimatedEbitdaAvg; - const ebitda = data?.getAnalystEstimate[index - 2]?.ebitda; + const estimatedRevenueAvgNextYear = + data?.getAnalystEstimate[index]?.estimatedRevenueAvg; + const estimatedEpsAvg = data?.getAnalystEstimate[index - 1]?.estimatedEpsAvg; const eps = data?.getAnalystEstimate[index - 2]?.eps; + const estimatedEPSAvgNextYear = + data?.getAnalystEstimate[index]?.estimatedEpsAvg; // Calculate percentage changes for each metric changeRevenue = calculateChange(estimatedRevenueAvg, revenue); - changeNetIncome = calculateChange(estimatedNetIncomeAvg, netIncome); - changeEBITDA = calculateChange(estimatedEbitdaAvg, ebitda); + changeRevenueNextYear = calculateChange( + estimatedRevenueAvgNextYear, + estimatedRevenueAvg, + ); changeEPS = calculateChange(estimatedEpsAvg, eps); + changeEPSNextYear = calculateChange( + estimatedEPSAvgNextYear, + estimatedEpsAvg, + ); + + console.log(estimatedEpsAvg, data?.getAnalystEstimate[index - 2]?.eps); } let optionsData = getPlotOptions() || null; @@ -520,16 +527,16 @@ {#if data?.getAnalystEstimate?.length !== 0}