-
- We categorize stocks into {sectorList?.length} sectors and {industryList?.length} industries, based on the company's primary business activity.
-
-
-
+
-
- {#each sectorList as sector}
-
sectorSelector(sector)} class="cursor-pointer text-white sm:hover:underline font-semibold text-lg sm:text-xl mt-5">
- Sector: {sector}
-
+
-
-
- {/each}
-
-
-
-
diff --git a/src/routes/industry/sectors/+page.ts b/src/routes/industry/sectors/+page.ts
new file mode 100644
index 00000000..84be3b29
--- /dev/null
+++ b/src/routes/industry/sectors/+page.ts
@@ -0,0 +1,34 @@
+import { getCache, setCache } from "$lib/store";
+
+export const load = async ({ parent }) => {
+ const getSectorOverview = async () => {
+ let output;
+
+ // Get cached data for the specific tickerID
+ const cachedData = getCache("", "getSectorOverview");
+ if (cachedData) {
+ output = cachedData;
+ } else {
+ const { apiKey, apiURL } = await parent();
+
+ const response = await fetch(apiURL + "/sector-overview", {
+ method: "GET",
+ headers: {
+ "Content-Type": "application/json",
+ "X-API-KEY": apiKey,
+ },
+ });
+
+ output = await response.json();
+
+ setCache("", output, "getSectorOverview");
+ }
+
+ return output;
+ };
+
+ // Make sure to return a promise
+ return {
+ getSectorOverview: await getSectorOverview(),
+ };
+};
diff --git a/src/routes/stocks/[tickerID]/forecast/+page.svelte b/src/routes/stocks/[tickerID]/forecast/+page.svelte
index b9b5329e..8cb2ad95 100644
--- a/src/routes/stocks/[tickerID]/forecast/+page.svelte
+++ b/src/routes/stocks/[tickerID]/forecast/+page.svelte
@@ -10,7 +10,7 @@
let changeEPS = 0;
function findIndex(data) {
const currentYear = new Date().getFullYear();
- return data?.findIndex((item) => item?.date >= currentYear && item?.revenue === null);
+ return data?.findIndex((item) => item?.date > currentYear && item?.revenue === null);
}
if (data?.getAnalystEstimate?.length !== 0) {