From ac94deff5d643a3405004efacea5bb6d83e0bce6 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 20 Dec 2024 20:25:46 +0100 Subject: [PATCH] add past earnings volatility --- src/lib/components/NextEarnings.svelte | 25 +- src/lib/components/PastEarnings.svelte | 456 ++++++++++++++++++ .../stocks/[tickerID]/metrics/+page.svelte | 6 +- 3 files changed, 483 insertions(+), 4 deletions(-) create mode 100644 src/lib/components/PastEarnings.svelte diff --git a/src/lib/components/NextEarnings.svelte b/src/lib/components/NextEarnings.svelte index 77274ca1..2f2bdc89 100644 --- a/src/lib/components/NextEarnings.svelte +++ b/src/lib/components/NextEarnings.svelte @@ -1,6 +1,7 @@ + +
+
+
+ + {#if isLoaded} + {#if rawData?.length !== 0} + + The average price volatility over this 3-day period is + {#if userTier !== 'Pro'} + ... Unlock content with + Pro Subscription + {:else} + ±{averageVolatility?.toFixed(2)}%. + During this period, the reported revenue exceeded expectations {positiveRevenueSurprisePercentage}% of the time & the reported EPS surpassed analyst estimates {positiveEpsSurprisePercentage}% of the time. + {/if} + +
+ + + + + {#each xData as item} + + {/each} + + + + + + + {#each tableRevenue as item, index} + + {/each} + + + + + + {#each tableRevenueEst as item, index} + + {/each} + + + + + {#each tableRevenueSurprise as item, index} + + {/each} + + + + + + {#each tableEPS as item, index} + + {/each} + + + + + + {#each tableEPSEst as item, index} + + {/each} + + + + + + {#each tableEPSSurprise as item, index} + + {/each} + + + + + {#each tableVolatility as item, index} + + {/each} + + + + + +
Date{item}
+ Reported Revenue + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + {abbreviateNumber(item)} + {:else} + n/a + {/if} + {/if} + {:else} + {abbreviateNumber(item)} + {/if} +
+ Est. Revenue + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + {abbreviateNumber(item)} + {:else} + n/a + {/if} + {/if} + {:else} + {abbreviateNumber(item)} + {/if} +
+ Revenue Surprise + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + 0 + ? "text-[#00FC50] before:content-['+']" + : item < 0 + ? "text-[#FF2F1F]" + : ""} + > + {abbreviateNumber(item)}% + + {:else} + n/a + {/if} + {/if} + {:else} + 0 + ? "text-[#00FC50] before:content-['+']" + : item < 0 + ? "text-[#FF2F1F]" + : ""} + > + {abbreviateNumber(item)}% + + {/if} +
+ Reported EPS + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + {abbreviateNumber(item)} + {:else} + n/a + {/if} + {/if} + {:else} + {abbreviateNumber(item)} + {/if} +
+ Est. EPS + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + {abbreviateNumber(item)} + {:else} + n/a + {/if} + {/if} + {:else} + {abbreviateNumber(item)} + {/if} +
+ EPS Surprise + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + 0 + ? "text-[#00FC50] before:content-['+']" + : item < 0 + ? "text-[#FF2F1F]" + : ""} + > + {abbreviateNumber(item)}% + + {:else} + n/a + {/if} + {/if} + {:else} + 0 + ? "text-[#00FC50] before:content-['+']" + : item < 0 + ? "text-[#FF2F1F]" + : ""} + > + {abbreviateNumber(item)}% + + {/if} +
+ Volatility + + {#if index !== 0} + {#if userTier !== "Pro"} + + Pro + + + + + {:else} + {#if item !== undefined && item !== null} + ±{abbreviateNumber(item)}% + {:else} + n/a + {/if} + {/if} + {:else} + ±{abbreviateNumber(item)}% + {/if} +
+
+ + + + {/if} + {:else} +
+
+ +
+
+ {/if} + + +
+
+
+ + + \ No newline at end of file diff --git a/src/routes/stocks/[tickerID]/metrics/+page.svelte b/src/routes/stocks/[tickerID]/metrics/+page.svelte index dc69b96f..81e8b14b 100644 --- a/src/routes/stocks/[tickerID]/metrics/+page.svelte +++ b/src/routes/stocks/[tickerID]/metrics/+page.svelte @@ -144,7 +144,7 @@ - {value !== null ? abbreviateNumber(value) : "-"} + {value !== null && value !== undefined ? abbreviateNumber(value) : "n/a"} {/each} @@ -162,9 +162,9 @@ ? 'text-[#FF2F1F]' : 'text-white'} font-medium border-b border-[#09090B]" > - {growthValue > 0 ? "+" : ""}{growthValue !== null + {growthValue > 0 ? "+" : ""}{growthValue !== null && growthValue !== undefined ? growthValue?.toFixed(2) + "%" - : "-"} + : "n/a"} {/each}