diff --git a/src/routes/stocks/[tickerID]/forecast/+layout.svelte b/src/routes/stocks/[tickerID]/forecast/+layout.svelte index 3323108a..16f4e702 100644 --- a/src/routes/stocks/[tickerID]/forecast/+layout.svelte +++ b/src/routes/stocks/[tickerID]/forecast/+layout.svelte @@ -1,5 +1,5 @@ - - { const postData = { ticker: params.tickerID, }; - const getAnalystInsight = async () => { - const response = await fetch(apiURL + "/analyst-insight", { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-API-KEY": apiKey, - }, - body: JSON.stringify(postData), - }); - const output = await response.json(); - return output; - }; const getPriceAnalysis = async () => { const response = await fetch(apiURL + "/price-analysis", { @@ -35,25 +23,10 @@ export const load = async ({ locals, params }) => { return output; }; - const getSentimentAnalysis = async () => { - const response = await fetch(apiURL + "/sentiment-analysis", { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-API-KEY": apiKey, - }, - body: JSON.stringify(postData), - }); - - const output = await response.json(); - return output; - }; // Make sure to return a promise return { - getAnalystInsight: await getAnalystInsight(), getPriceAnalysis: await getPriceAnalysis(), - getSentimentAnalysis: await getSentimentAnalysis(), }; }; diff --git a/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte b/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte index 5862820d..f6ab521e 100644 --- a/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte +++ b/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte @@ -1,100 +1,537 @@ - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Forecast AI · Stocknear - - + - - - - - - - - - - - - - -
-
+
+
-
- -
- +
+

+ {$displayCompanyName} AI Forecast +

+ {#if Object?.keys(data?.getPriceAnalysis)?.length > 0} +
+
+
+
+
+

Stock Price Forecast

+ +
+

+ Using our AI model trained on historical data, we generated + a 12‑month forecast for {$displayCompanyName} + ({$stockTicker}) stock. The model estimates a median target + price of {medianPriceTarget}—ranging from a low of {lowPriceTarget} + to a high of {highPriceTarget}—which suggests {medianChange > + 0 + ? "an increase" + : "a decrease"} of {medianChange}% compared to the current + price of {price}. +

+
+
+
+ {#if optionsPieChart !== null} + + {/if} +
+
+ Analyst Consensus: {consensusRating} +
+
+
+
+
+ {#if data?.user?.tier !== "Pro"} + + {:else if optionsPriceForecast !== null} + + {/if} +
+
+ + + + + + + + + + + + + + +
Target LowAverageMedianHigh
Price${lowPriceTarget}${avgPriceTarget} ${medianPriceTarget}${highPriceTarget}
Change 0 && data?.user?.tier === "Pro" + ? "before:content-['+'] text-[#00FC50]" + : "text-[#FF2F1F]"} + > + {#if data?.user?.tier !== "Pro"} + + + + + + + {:else} + {lowChange}% + {/if} + 0 && data?.user?.tier === "Pro" + ? "before:content-['+'] text-[#00FC50]" + : "text-[#FF2F1F]"} + > + {#if data?.user?.tier !== "Pro"} + + + + + + + {:else} + {avgChange}% + {/if} + 0 && data?.user?.tier === "Pro" + ? "before:content-['+'] text-[#00FC50]" + : "text-[#FF2F1F]"} + > + {#if data?.user?.tier !== "Pro"} + + + + + + + {:else} + {medianChange}% + {/if} + 0 && data?.user?.tier === "Pro" + ? "before:content-['+'] text-[#00FC50]" + : "text-[#FF2F1F]"} + > + {#if data?.user?.tier !== "Pro"} + + + + + + + {:else} + {highChange}% + {/if}
+
+
+
- - - -
- -
-
- - -
- -
-
+ {:else} + + {/if}
+ +