diff --git a/src/lib/components/NextEarnings.svelte b/src/lib/components/NextEarnings.svelte new file mode 100644 index 00000000..bcb99c18 --- /dev/null +++ b/src/lib/components/NextEarnings.svelte @@ -0,0 +1,88 @@ + + + +{#if Object?.keys(rawData)?.length !== 0} + +
+ +
+ +
+
+ +
+ + +
+ +
+
+ + {#if data?.user?.tier === 'Pro'} +
+ {$displayCompanyName} is scheduled to release its earnings on {new Date(rawData?.date ?? null)?.toLocaleString('en-US', { + month: 'short', + day: 'numeric', + year: 'numeric', + timeZone: 'Europe/Berlin' + })}, + {#if compareTimes(rawData?.time, '16:00') > 0} + after market closes. + {:else if compareTimes(rawData?.time, '09:30') < 0} + before market opens. + {:else} + during market hours. + {/if} +
+ Analysts project revenue of {abbreviateNumber(rawData?.revenueEst,true)}, reflecting a + {revenueRatio}% YoY {revenueRatio > 0 ? 'growth' : revenueRatio < 0 ? 'shrinking' : ''} and earnings per share of + {rawData?.epsEst}, making a {epsRatio}% {epsRatio > 0 ? 'increase' : epsRatio < 0 ? 'decrease' : ''} YoY. +
+ {:else} +
+ + Unlock content with Pro Subscription +
+ {/if} + +
+ + +
+{/if} \ No newline at end of file diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index 055bf5aa..3ac60e05 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -32,7 +32,7 @@ let optionsMode = 'premium'; - function compareTimes(time1, time2) { +function compareTimes(time1, time2) { const [hours1, minutes1] = time1.split(':').map(Number); const [hours2, minutes2] = time2.split(':').map(Number); diff --git a/src/routes/stocks/[tickerID]/+layout.server.ts b/src/routes/stocks/[tickerID]/+layout.server.ts index edf27765..aad524b9 100644 --- a/src/routes/stocks/[tickerID]/+layout.server.ts +++ b/src/routes/stocks/[tickerID]/+layout.server.ts @@ -51,7 +51,7 @@ export const load = async ({ params, locals, cookies, setHeaders }) => { const endpoints = [ '/similar-stocks', '/stockdeck', '/analyst-summary-rating', '/stock-quote', - '/bull-bear-say', '/wiim', '/top-etf-ticker-holder', '/one-day-price' + '/bull-bear-say','/wiim', '/top-etf-ticker-holder', '/one-day-price','/next-earnings' ]; const promises = [ @@ -63,7 +63,7 @@ export const load = async ({ params, locals, cookies, setHeaders }) => { const [ getSimilarStock, getStockDeck, getAnalystRating, getStockQuote, - getBullBearSay, getWhyPriceMoved, getTopETFHolder, getOneDayPrice, + getBullBearSay, getWhyPriceMoved, getTopETFHolder, getOneDayPrice, getNextEarnings, getUserWatchlist, getCommunitySentiment ] = await Promise.all(promises); @@ -78,6 +78,7 @@ export const load = async ({ params, locals, cookies, setHeaders }) => { getWhyPriceMoved, getTopETFHolder, getOneDayPrice, + getNextEarnings, getUserWatchlist, getCommunitySentiment, companyName: cleanString(getStockDeck?.at(0)?.companyName), diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index 5220dea2..440b8a28 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -6,6 +6,7 @@ import {getCache, setCache, corporateLobbyingComponent, taRatingComponent, swapComponent, analystInsightComponent, governmentContractComponent, optionsNetFlowComponent, borrowedShareComponent, clinicalTrialComponent, optionComponent, failToDeliverComponent, marketMakerComponent, analystEstimateComponent, sentimentComponent, screenWidth, displayCompanyName, numberOfUnreadNotification, globalForm, varComponent, shareStatisticsComponent, enterpriseComponent, darkPoolComponent, retailVolumeComponent, shareholderComponent, trendAnalysisComponent, revenueSegmentationComponent, priceAnalysisComponent, fundamentalAnalysisComponent, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, stockTicker, isOpen, isBeforeMarketOpen, isWeekend} from '$lib/store'; import { onDestroy, onMount } from 'svelte'; import BullBearSay from '$lib/components/BullBearSay.svelte'; + import NextEarnings from '$lib/components/NextEarnings.svelte'; import CommunitySentiment from '$lib/components/CommunitySentiment.svelte'; import Lazy from '$lib/components/Lazy.svelte'; @@ -1173,7 +1174,9 @@ function changeChartType() { {/if} - +
+ +