{#await import('$lib/components/VaR.svelte') then {default: Comp}}
diff --git a/src/routes/etf/[tickerID]/forecast/+layout.svelte b/src/routes/etf/[tickerID]/forecast/+layout.svelte
new file mode 100644
index 00000000..c5a9947c
--- /dev/null
+++ b/src/routes/etf/[tickerID]/forecast/+layout.svelte
@@ -0,0 +1,77 @@
+
+
+
+
+
diff --git a/src/routes/etf/[tickerID]/forecast/+page.server.ts b/src/routes/etf/[tickerID]/forecast/+page.server.ts
new file mode 100644
index 00000000..c3096e0e
--- /dev/null
+++ b/src/routes/etf/[tickerID]/forecast/+page.server.ts
@@ -0,0 +1,54 @@
+export const load = async ({ locals, params }) => {
+ const { apiURL, apiKey } = locals;
+ 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", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "X-API-KEY": apiKey,
+ },
+ body: JSON.stringify(postData),
+ });
+
+ const output = await response.json();
+ 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/etf/[tickerID]/forecast/+page.svelte b/src/routes/etf/[tickerID]/forecast/+page.svelte
new file mode 100644
index 00000000..2f1f00c9
--- /dev/null
+++ b/src/routes/etf/[tickerID]/forecast/+page.svelte
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+ {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""}
+ {$displayCompanyName} ({$stockTicker}) Forecast AI · stocknear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts b/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts
index 658b0492..c3096e0e 100644
--- a/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts
+++ b/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts
@@ -1,13 +1,10 @@
export const load = async ({ locals, params }) => {
- const getAnalystTickerHistory = async () => {
- const { apiURL, apiKey } = locals;
-
- const postData = {
- ticker: params.tickerID,
- };
-
- // make the POST request to the endpoint
- const response = await fetch(apiURL + "/analyst-ticker-history", {
+ const { apiURL, apiKey } = locals;
+ const postData = {
+ ticker: params.tickerID,
+ };
+ const getAnalystInsight = async () => {
+ const response = await fetch(apiURL + "/analyst-insight", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -17,12 +14,41 @@ export const load = async ({ locals, params }) => {
});
const output = await response.json();
+ return output;
+ };
+ const getPriceAnalysis = async () => {
+ const response = await fetch(apiURL + "/price-analysis", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "X-API-KEY": apiKey,
+ },
+ body: JSON.stringify(postData),
+ });
+
+ const output = await response.json();
+ 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 {
- getAnalystTickerHistory: await getAnalystTickerHistory(),
+ 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 abe27a5d..2f1f00c9 100644
--- a/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte
+++ b/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte
@@ -1,8 +1,6 @@