From f6f3b473d72ccd7502053d7b9c1287893ff90d12 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 16 Oct 2024 15:44:31 +0200 Subject: [PATCH] add pre-post market gainers to dashboard --- src/routes/+page.server.ts | 8 +- src/routes/+page.svelte | 1230 +++++++++++++++++++++--------------- 2 files changed, 711 insertions(+), 527 deletions(-) diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index def2a43a..4b795d33 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -43,7 +43,7 @@ export const actions = { login: async ({ request, locals }) => { const { formData, errors } = await validateData( await request.formData(), - loginUserSchema + loginUserSchema, ); if (errors) { @@ -77,7 +77,7 @@ export const actions = { register: async ({ locals, request }) => { const { formData, errors } = await validateData( await request.formData(), - registerUserSchema + registerUserSchema, ); if (errors) { return fail(400, { @@ -94,7 +94,7 @@ export const actions = { //let username = generateUsername(formData.name.split(' ').join('')).toLowerCase(); try { - const newUser = await locals.pb.collection("users").create(formData); + await locals.pb.collection("users").create(formData); /* await locals.pb?.collection('users').update( newUser?.id, { @@ -147,7 +147,7 @@ export const actions = { const redirectURL = `${url.origin}/oauth`; const targetItem = authMethods.authProviders?.findIndex( - (item) => item?.name === providerSelected + (item) => item?.name === providerSelected, ); //console.log("==================") //console.log(authMethods.authProviders) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 3e0f3319..9712cda9 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,18 +1,15 @@ - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} Free Stock Analysis Information for Small Investors · stocknear + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Free + Stock Analysis Information for Small Investors · stocknear - + - - - + + + - - - + + + - +
+ {#if data?.user?.tier !== "Pro" || data?.user?.freeTrial === true} +
+ + +
+

+ 🎃 Limited Halloween Special + Save 16% on Pro Subscription and + boost your investing game! +

+ + Get Pro Now + +
+
+ {/if} +
+
+ {#if Feedback} + + {/if} -
- - {#if data?.user?.tier !== 'Pro' || data?.user?.freeTrial === true} -
- - -
-

- 🎃 Limited Halloween Special - Save 16% on Pro Subscription and boost your investing game! -

- - Get Pro Now - -
-
-{/if} - -
-
- - {#if Feedback} - - {/if} - -

+

Stock Analysis for - Data Freaks + Data Freaks

- -

- Dashboard -

+

+ 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'} - - +
+
+ + +
+
+ {marketStatus === 0 + ? "Top" + : marketStatus === 1 + ? "Pre-Market" + : "After-Market"} Gainers
- - - - - - Symbol - Prem - Strike - {optionsMode === 'openInterest' ? 'OI' : 'Vol'} - C/P - Expiry - - - - {#each optionsTable as item} +
+
+ + + + + Symbol + + Price + Change + + + + {#each gainersList as item} - {item?.ticker} + {item?.symbol} - - {abbreviateNumber(item?.cost_basis,true)} + - + + {item?.price?.toFixed(2)} + + + {#if item?.changesPercentage >= 0} + +{item?.changesPercentage >= 1000 + ? abbreviateNumber(item?.changesPercentage) + : item?.changesPercentage?.toFixed(2)}% + {:else} + {item?.changesPercentage <= -1000 + ? abbreviateNumber(item?.changesPercentage) + : item?.changesPercentage?.toFixed(2)}% + + {/if} + + + {/each} + + + +
+ + +
+
+ {marketStatus === 0 + ? "Top" + : marketStatus === 1 + ? "Pre-Market" + : "After-Market"} Losers +
+
+
+ + + + + Symbol + + Price + Change + + + + {#each losersList as item} + + + {item?.symbol} + + + + {item?.price?.toFixed(2)} + + + {#if item?.changesPercentage >= 0} + +{item?.changesPercentage >= 1000 + ? abbreviateNumber(item?.changesPercentage) + : item?.changesPercentage?.toFixed(2)}% + {:else} + {item?.changesPercentage <= -1000 + ? abbreviateNumber(item?.changesPercentage) + : item?.changesPercentage?.toFixed(2)}% + + {/if} + + + {/each} + + + +
+
+ +
+ + +
+
+ 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)} + + {abbreviateNumber( + optionsMode === "openInterest" + ? item?.open_interest + : item?.volume, + )} - + {item?.put_call} - - {reformatDate(item?.date_expiration)} + + {reformatDate(item?.date_expiration)} - {/each} - - - -
- - - -
-
- Dividend Announcement (NYSE Time) -
+ {/each} + + + + + + + +
+
+ Dividend Announcement (NYSE Time)
- - - {#if data?.getDashboard?.recentDividends?.length !== 0} +
+
+ + {#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' })} -
  • + {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} + + +
    +
    + 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} -
    - + {: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} -
    -
    - - -
    - - - - - - -
- - -
- + {/if} + +
+
+
+
- - - - - - - - \ No newline at end of file + font-size: 56px; /* Adjust the font size as needed */ + font-weight: bold; /* Adjust the font weight as needed */ + color: transparent; /* Make the text transparent */ + -webkit-text-stroke: 1px #cbd5e1; /* Add a black stroke outline with a thickness of 2px */ + } +