diff --git a/src/routes/cramer-tracker/+page.ts b/src/routes/cramer-tracker/+page.ts index a797b70d..7d76ed8c 100644 --- a/src/routes/cramer-tracker/+page.ts +++ b/src/routes/cramer-tracker/+page.ts @@ -6,17 +6,18 @@ export const load = async ({parent}) => { const getCramerTracker = async () => { let output; - const data = await parent(); const cachedData = getCache('', 'getCramerTracker'); if (cachedData) { output = cachedData; } else { - // make the POST request to the endpoint - const response = await fetch(data?.apiURL + '/cramer-tracker', { + + const { apiKey, apiURL } = await parent(); + + const response = await fetch(apiURL + '/cramer-tracker', { method: 'GET', headers: { - "Content-Type": "application/json", "X-API-KEY": data?.apiKey + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index b408a286..4a4df93f 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -3,7 +3,6 @@ import { onMount } from 'svelte'; import * as Avatar from "$lib/components/shadcn/avatar/index.js"; - import { Button } from "$lib/components/shadcn/button/index.ts"; import * as Card from "$lib/components/shadcn/card/index.ts"; import * as Table from "$lib/components/shadcn/table/index.ts"; import ArrowUpRight from "lucide-svelte/icons/arrow-up-right"; @@ -19,6 +18,10 @@ const quickInfo = data?.getDashboard?.quickInfo; +function reformatDate(dateString) { + return dateString.substring(5, 7) + '/' + dateString.substring(8) + '/' + dateString.substring(2, 4); +} + function latestInfoDate(inputDate) { // Convert the input date string to milliseconds since epoch const inputDateMs = Date?.parse(inputDate); @@ -219,7 +222,7 @@ onMount( async() => { {item?.put_call} - 07/26/24 + {reformatDate(item?.date_expiration)} {/each} diff --git a/src/routes/reddit-tracker/+page.svelte b/src/routes/reddit-tracker/+page.svelte new file mode 100644 index 00000000..1911be0e --- /dev/null +++ b/src/routes/reddit-tracker/+page.svelte @@ -0,0 +1,472 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Wallstreetbets Tracker · stocknear + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+
+
+ stock logo +
+

+ r/Wallstreetbets Tracker +

+
+ +
+ Description: Like 4chan found a Bloomberg Terminal. +
+
+ + +
+
+
+ + + + {#if isLoaded} + +
+ + + Post Activity + Number of Posts in the last 24 hours: + + +{postList?.at(-1)} + posts today + + + + +
+ +
+ +
+
+ + + + Comment Activity + Number of Comments in the last 24 hours: + + +{abbreviateNumber(commentList?.at(-1))} + comments today + + + +
+ +
+
+
+ + + + Company Spread + Number of Tickers discussed in the last 24 hours: + + +{numCompanyList?.at(-1)} + discussed today + + + +
+ +
+
+
+ +
+ +
+ + +
+
+ Latest Posts +
+
+
+ + {#each data?.getRedditTracker?.posts as item} +
+
+ {item?.title} +
+ + {#if item?.selftext?.length !== 0} +
+ {item?.selftext?.length < 400 ? removeHttpsStrings(item?.selftext) : removeHttpsStrings(item?.selftext)?.slice(0,240) +'...'} +
+ {/if} + + + + +
+ {/each} +
+
+ + + + + Currently Trending + + + + + + + +
+ + {:else} +
+
+ +
+
+ {/if} + + +
+
+
+ + + + +
+
+
+ + \ No newline at end of file diff --git a/src/routes/reddit-tracker/+page.ts b/src/routes/reddit-tracker/+page.ts new file mode 100644 index 00000000..931ab73e --- /dev/null +++ b/src/routes/reddit-tracker/+page.ts @@ -0,0 +1,39 @@ +import {getCache, setCache } from '$lib/store'; + + + +export const load = async ({parent}) => { + + const getRedditTracker = async () => { + let output; + + const cachedData = getCache('', 'getRedditTracker'); + if (cachedData) { + output = cachedData; + } else { + + const { apiKey, apiURL } = await parent(); + + const response = await fetch(apiURL + '/reddit-tracker', { + method: 'GET', + headers: { + "Content-Type": "application/json", "X-API-KEY": apiKey + }, + }); + + output = await response.json(); + + setCache('', output, 'getRedditTracker'); + + } + + //output = data?.user?.tier !== 'Pro' ? output?.slice(0,6) : output; + + return output; + }; + + // Make sure to return a promise + return { + getRedditTracker: await getRedditTracker() + }; +}; \ No newline at end of file