From 53b7933ac890d10549380db230b36e81fc8c77aa Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 18 Sep 2024 12:52:33 +0200 Subject: [PATCH] redirect --- src/routes/home/+page.svelte | 690 ----------------------------------- src/routes/home/+page.ts | 42 +-- 2 files changed, 4 insertions(+), 728 deletions(-) delete mode 100644 src/routes/home/+page.svelte diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte deleted file mode 100644 index 1de7280f..00000000 --- a/src/routes/home/+page.svelte +++ /dev/null @@ -1,690 +0,0 @@ - - - - - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Free Stock Analysis Information for Small Investors · stocknear - - - - - - - - - - - - - - - - - - - -
- -
-
- - {#if Feedback} - - {/if} - - -
- - Options Flow Filter - -
- - New - -
-
- - -

- Dashboard -

- - - -
-
- - - - Most Active - - - - - {quickInfo?.active?.symbol} -

- - {#if quickInfo?.active?.changesPercentage >=0} - - +{quickInfo?.active?.changesPercentage?.toFixed(2)}% - {:else} - - {quickInfo?.active?.changesPercentage?.toFixed(2)}% - {/if} -

-
-
- - - - Top Stock - - - - - {quickInfo?.winner?.symbol} -

- - {#if quickInfo?.winner?.changesPercentage >=0} - - +{abbreviateNumber(quickInfo?.winner?.changesPercentage?.toFixed(2))}% - {:else} - - {abbreviateNumber(quickInfo?.winner?.changesPercentage?.toFixed(2))}% - {/if} -

-
-
- - - - Worst Stock - - - - - {quickInfo?.loser?.symbol} -

- - {#if quickInfo?.loser?.changesPercentage >=0} - - +{abbreviateNumber(quickInfo?.loser?.changesPercentage?.toFixed(2))}% - {:else} - - {abbreviateNumber(quickInfo?.loser?.changesPercentage?.toFixed(2))}% - {/if} -

-
-
- - - - Top Sector - - - - - - {quickInfo?.topSector?.sector?.length > 15 ? quickInfo?.topSector?.sector?.slice(0,15) +'...' : quickInfo?.topSector?.sector} - -

- {#if quickInfo?.topSector?.changesPercentage >=0} - - +{abbreviateNumber(quickInfo?.topSector?.changesPercentage?.toFixed(2))}% - {:else} - - {abbreviateNumber(quickInfo?.topSector?.changesPercentage?.toFixed(2))}% - {/if} -

-
-
-
- - - - -
- - - -
-
- Hottest Options Contract - - View All - -
- Recent hedge fund options with the highest ... - - - changeTable('premium')} value="premium" class="text-sm">Premium - changeTable('volume')} value="volume" class="text-sm">Volume - changeTable('openInterest')} value="openInterest" class="text-sm">{$screenWidth < 640 ? 'OI' : 'Open Interest'} - - -
-
- - - - - Symbol - Prem - Strike - {optionsMode === 'openInterest' ? 'OI' : 'Vol'} - C/P - Expiry - - - - {#each optionsTable as item} - - - {item?.ticker} - - - {abbreviateNumber(item?.cost_basis,true)} - - - ${item?.strike_price} - - - {abbreviateNumber(optionsMode === 'openInterest' ? item?.open_interest : item?.volume)} - - - {item?.put_call} - - - {reformatDate(item?.date_expiration)} - - {/each} - - - -
- - - -
-
- Dividend Announcement (NYSE Time) -
-
-
- - {#if data?.getDashboard?.recentDividends?.length !== 0} -
    - {#each data?.getDashboard?.recentDividends as item} - {item?.name} ({item?.symbol}) has announced its upcoming dividend details as of {convertTimestamp(item?.updated)}: - -
  • - Dividend: ${item?.dividend} per share ({(item?.dividend/item?.dividendPrior-1) > 0 ? '+' :''}{((item?.dividend/item?.dividendPrior-1)*100)?.toFixed(2)}% YoY) -
  • -
  • - Dividend Yield: {item?.dividendYield?.toFixed(2)}% -
  • -
  • - Ex-Dividend Date: {new Date(item?.exDividendDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} -
  • -
  • - Payable Date: {new Date(item?.payableDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} -
  • -
  • - Record Date: {new Date(item?.recordDate)?.toLocaleString('en-US', { month: 'short', day: 'numeric', year: 'numeric', daySuffix: '2-digit' })} -
  • - - {/each} -
- {:else} -
- - Currently, there are no dividend announcement reports available. -
- {/if} - -
-
- - - -
- - - -
- - - -
-
- Upcoming Earnings - - View All - -
-
-
- - {#if data?.getDashboard?.upcomingEarnings?.length !== 0} -
    - {#each data?.getDashboard?.upcomingEarnings as item} -
  • - {item?.name} ({item?.symbol}) - {item?.isToday === true ? 'will report today' : ['Monday', 'Tuesday', 'Wednesday', 'Thursday'].includes(new Date().toLocaleDateString('en-US', { weekday: 'long' })) ? "will report tomorrow" : "will report monday"} - {#if item?.time} - {#if compareTimes(item?.time, '16:00') >= 0} - after market closes. - {:else if compareTimes(item?.time, '09:30') <= 0} - before market opens. - {:else} - during market. - {/if} - {/if}Analysts estimate {abbreviateNumber(item?.revenueEst,true)} in revenue ({((item?.revenueEst/item?.revenuePrior-1)*100)?.toFixed(2)}% YoY) and ${item?.epsEst} in earnings per share ({((item?.epsEst/item?.epsPrior-1)*100)?.toFixed(2)}% YoY).
  • - - {/each} -
- {:else} -
- - Currently, there are no upcoming earnings reports available that include the latest analyst estimates. -
- {/if} -
-
- - - -
-
- Recent Earnings (NYSE Time) -
-
-
- - {#if data?.getDashboard?.recentEarnings?.length !== 0} -
    - {#each data?.getDashboard?.recentEarnings as item} - {item?.name} ({item?.symbol}) has released its quarterly earnings at {formatTime(item?.time)}: - -
  • - Revenue of {abbreviateNumber(item?.revenue,true)} {item?.revenueSurprise > 0 ? 'exceeds' : 'misses'} estimates by {abbreviateNumber(Math.abs(item?.revenueSurprise),true)}, with {((item?.revenue/item?.revenuePrior-1)*100)?.toFixed(2)}% YoY {(item?.revenue/item?.revenuePrior-1) < 0 ? 'decline' : 'growth'}. -
  • -
  • - EPS of ${item?.eps} {item?.epsSurprise > 0 ? 'exceeds' : 'misses'} estimates by ${item?.epsSurprise?.toFixed(2)}, with {(((item?.eps - item?.epsPrior) / Math.abs(item?.epsPrior)) * 100)?.toFixed(2)}% YoY {((item?.eps - item?.epsPrior) / Math.abs(item?.epsPrior)) < 0 ? 'decline' : 'growth'}. -
  • - - {/each} -
- {:else} -
- - Currently, there are no recent earnings reports available. -
- {/if} -
-
- - -
- - - -
- - -
- Market Momentum -
-
- - {#each data?.getDashboard?.wiimFeed as item} -
-
-
- - {item?.text} -
-
- {#each item?.stocks as item2} - - {/each} -
- -
- {#if latestInfoDate(item?.date)} - - · - {/if} - - {formatDate(item?.date)} ago - -
- -
-
- -
-
- {/each} -
-
- - - Market News - - -
- {#each data?.getDashboard?.marketNews as item} -
-
- - {formatDate(item?.date)} ago - -
- - {item?.text} - -
- {/each} - - -
- -
-
-
-
- - -
- -
-
- - - - - - - - - - \ No newline at end of file diff --git a/src/routes/home/+page.ts b/src/routes/home/+page.ts index a648317d..712a8338 100644 --- a/src/routes/home/+page.ts +++ b/src/routes/home/+page.ts @@ -1,39 +1,5 @@ -import { getCache, setCache } from '$lib/store'; -import { redirect } from '@sveltejs/kit'; +import { redirect } from "@sveltejs/kit"; - -export const load = async ({parent}) => { - - const { user, apiKey, apiURL } = await parent(); - - - if (!user) { - redirect(303, '/'); - } - - const getDashboard = async () => { - - // Get cached data for the specific tickerID - const cachedData = getCache('', 'getDashboard'); - if (cachedData) { - return cachedData; - } else { - - const response = await fetch(apiURL + '/dashboard-info', { - method: 'GET', - headers: { - "Content-Type": "application/json", "X-API-KEY": apiKey - }, - }); - - const output = await response?.json(); - setCache('', output, 'getDashboard'); - return output; - } - }; - - // Make sure to return a promise - return { - getDashboard: await getDashboard(), - }; -}; \ No newline at end of file +export const load = async () => { + redirect(303, "/"); +};