diff --git a/src/lib/components/AnalystInsight.svelte b/src/lib/components/AnalystInsight.svelte index d7e3b9a3..6fb456d5 100644 --- a/src/lib/components/AnalystInsight.svelte +++ b/src/lib/components/AnalystInsight.svelte @@ -1,13 +1,9 @@
@@ -87,8 +42,6 @@ /> {#if data?.user?.tier === 'Pro'} - {#if isLoaded} - {#if Object?.keys(rawData)?.length !== 0}
The AI model summarizes the latest Wallstreet Analyst Insight Report and extracts key points for you, focusing on what matters most.
@@ -99,22 +52,22 @@
- +
-
+
- Last Report from {rawData.date} - {#if latestInfoDate(rawData.date)} + Last Report from {data?.getAnalystInsight?.date} + {#if latestInfoDate(data?.getAnalystInsight?.date)} {/if}
- {rawData?.insight} + {data?.getAnalystInsight?.insight}
@@ -125,16 +78,6 @@
- {/if} - {:else} -
-
- -
-
- {/if} {:else}
diff --git a/src/lib/components/PriceAnalysis.svelte b/src/lib/components/PriceAnalysis.svelte index 38c141f0..d9648a02 100644 --- a/src/lib/components/PriceAnalysis.svelte +++ b/src/lib/components/PriceAnalysis.svelte @@ -1,9 +1,9 @@ - @@ -223,7 +171,6 @@ $: {
{#if isLoaded} - {#if Object?.keys(priceAnalysisDict)?.length !== 0}
@@ -331,6 +278,7 @@ $: {
{/if} +
diff --git a/src/lib/components/SentimentAnalysis.svelte b/src/lib/components/SentimentAnalysis.svelte index 2f6cdc03..92d60e15 100644 --- a/src/lib/components/SentimentAnalysis.svelte +++ b/src/lib/components/SentimentAnalysis.svelte @@ -1,16 +1,15 @@ @@ -95,7 +42,6 @@ $: { /> - {#if isLoaded} {#if sentimentList?.length !== 0} @@ -216,26 +162,7 @@ $: { - - {:else} -
-
- -
-
- {/if} - {:else} -
-
- -
-
- {/if} diff --git a/src/routes/crypto/[tickerID]/+layout.svelte b/src/routes/crypto/[tickerID]/+layout.svelte index d99ee218..d2e54f34 100644 --- a/src/routes/crypto/[tickerID]/+layout.svelte +++ b/src/routes/crypto/[tickerID]/+layout.svelte @@ -110,8 +110,9 @@ function changeSection(state, item) { scrollToItem(item); const sectionMap = { - 'stats': '/stats', - 'news': '/news', + stats: "/stats", + forecast: "/forecast", + news: "/news", }; if (state !== 'overview' && sectionMap[state]) { @@ -377,18 +378,7 @@ $: { -let charNumber = 12; - -$: { - if($screenWidth < 640) - { - charNumber = 12; - } - else { - charNumber = 25; - } -} - +$: charNumber = $screenWidth < 640 ? 12 : 25; $: { if($cryptoTicker && typeof window !== 'undefined' && $page.url.pathname === `/crypto/${$cryptoTicker}`) @@ -403,6 +393,7 @@ $: { const parts = $page?.url?.pathname?.split('/'); const sectionMap = { 'stats': 'stats', + 'forecast': 'forecast', 'congress-trading': 'congress-trading', 'news': 'news' }; @@ -637,6 +628,12 @@ $: { (changeSection('stats','item2'))} class="px-3 text-sm sm:text-[1rem] font-medium text-gray-400 sm:hover:text-white {displaySection === 'stats' ? 'text-white ' : 'bg-[#09090B]'}" >Stats
+
  • + (changeSection('forecast','item3'))} class="px-3 text-sm sm:text-[1rem] font-medium text-gray-400 sm:hover:text-white {displaySection === 'forecast' ? 'text-white ' : 'bg-[#09090B]'}" > + Forecast + +
    +
  • (changeSection('congress-trading','item7'))} class="px-3 text-sm sm:text-[1rem] font-medium text-gray-400 sm:hover:text-white {displaySection === 'congress-trading' ? 'text-white ' : 'bg-[#09090B]'}" > Insider diff --git a/src/routes/crypto/[tickerID]/+page.svelte b/src/routes/crypto/[tickerID]/+page.svelte index f0e88397..e87b0de6 100644 --- a/src/routes/crypto/[tickerID]/+page.svelte +++ b/src/routes/crypto/[tickerID]/+page.svelte @@ -3,7 +3,7 @@ import {AreaSeries, Chart, PriceLine, CandlestickSeries} from 'svelte-lightweight-charts'; import { TrackingModeExitMode } from 'lightweight-charts'; - import {setCache, getCache, screenWidth, taRatingComponent, displayCompanyName, numberOfUnreadNotification, globalForm, priceAnalysisComponent, trendAnalysisComponent, sentimentComponent, varComponent, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, cryptoTicker} from '$lib/store'; + import {setCache, getCache, screenWidth, taRatingComponent, displayCompanyName, numberOfUnreadNotification, globalForm, varComponent, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, cryptoTicker} from '$lib/store'; import { onDestroy } from 'svelte'; import CryptoKeyInformation from '$lib/components/CryptoKeyInformation.svelte'; import Lazy from '$lib/components/Lazy.svelte'; @@ -1125,32 +1125,7 @@ afterUpdate(async () => { - - - - -
    - {#await import('$lib/components/PriceAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    - - -
    - {#await import('$lib/components/TrendAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    - - -
    - {#await import('$lib/components/SentimentAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    +
    diff --git a/src/routes/crypto/[tickerID]/forecast/+layout.svelte b/src/routes/crypto/[tickerID]/forecast/+layout.svelte new file mode 100644 index 00000000..c5a9947c --- /dev/null +++ b/src/routes/crypto/[tickerID]/forecast/+layout.svelte @@ -0,0 +1,77 @@ + + +
    +
    + + +
    +
    + + diff --git a/src/routes/crypto/[tickerID]/forecast/+page.server.ts b/src/routes/crypto/[tickerID]/forecast/+page.server.ts new file mode 100644 index 00000000..c3096e0e --- /dev/null +++ b/src/routes/crypto/[tickerID]/forecast/+page.server.ts @@ -0,0 +1,54 @@ +export const load = async ({ locals, params }) => { + const { apiURL, apiKey } = locals; + const postData = { + ticker: params.tickerID, + }; + const getAnalystInsight = async () => { + const response = await fetch(apiURL + "/analyst-insight", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + const getPriceAnalysis = async () => { + const response = await fetch(apiURL + "/price-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + const getSentimentAnalysis = async () => { + const response = await fetch(apiURL + "/sentiment-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + // Make sure to return a promise + return { + getAnalystInsight: await getAnalystInsight(), + getPriceAnalysis: await getPriceAnalysis(), + getSentimentAnalysis: await getSentimentAnalysis(), + }; +}; diff --git a/src/routes/crypto/[tickerID]/forecast/+page.svelte b/src/routes/crypto/[tickerID]/forecast/+page.svelte new file mode 100644 index 00000000..2f1f00c9 --- /dev/null +++ b/src/routes/crypto/[tickerID]/forecast/+page.svelte @@ -0,0 +1,63 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$stockTicker}) Forecast AI · stocknear + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + +
    +
    + + +
    + +
    +
    + + + +
    + +
    +
    +
    +
    +
    +
    diff --git a/src/routes/etf/[tickerID]/+layout.svelte b/src/routes/etf/[tickerID]/+layout.svelte index bcc51e64..e5f14a63 100644 --- a/src/routes/etf/[tickerID]/+layout.svelte +++ b/src/routes/etf/[tickerID]/+layout.svelte @@ -120,11 +120,12 @@ async function loadSearchData() { scrollToItem(item); const sectionMap = { - 'options': '/options', - 'holdings': '/holdings', - 'dividends': '/dividends', - 'stats': '/stats', - 'news': '/news', + options: '/options', + holdings: "/holdings", + forecast: "/forecast", + dividends: '/dividends', + stats: '/stats', + news: '/news', }; if (state !== 'overview' && sectionMap[state]) { @@ -419,6 +420,7 @@ $: { const parts = $page?.url?.pathname?.split('/'); const sectionMap = { 'stats': 'stats', + 'forecast': 'forecast', 'options': 'options', 'holdings': 'holdings', 'dividends': 'dividends', @@ -670,6 +672,12 @@ $: {
  • +
  • + (changeSection('forecast','item10'))} class="px-2 text-sm sm:text-[1rem] font-medium text-gray-400 sm:hover:text-white {displaySection === 'forecast' ? 'text-white ' : 'bg-[#09090B]'}" > + Forecast + +
    +
  • (changeSection('options','item3'))} class="px-2 text-sm sm:text-[1rem] font-medium text-gray-400 sm:hover:text-white {displaySection === 'options' ? 'text-white ' : 'bg-[#09090B]'}" > Options diff --git a/src/routes/etf/[tickerID]/+page.svelte b/src/routes/etf/[tickerID]/+page.svelte index e07254c8..bc50a26c 100644 --- a/src/routes/etf/[tickerID]/+page.svelte +++ b/src/routes/etf/[tickerID]/+page.svelte @@ -1296,32 +1296,7 @@ async function exportData() { {/await}
  • - - - -
    - {#await import('$lib/components/PriceAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    - - -
    - {#await import('$lib/components/TrendAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    - - -
    - {#await import('$lib/components/SentimentAnalysis.svelte') then {default: Comp}} - - {/await} -
    -
    - +
    {#await import('$lib/components/VaR.svelte') then {default: Comp}} diff --git a/src/routes/etf/[tickerID]/forecast/+layout.svelte b/src/routes/etf/[tickerID]/forecast/+layout.svelte new file mode 100644 index 00000000..c5a9947c --- /dev/null +++ b/src/routes/etf/[tickerID]/forecast/+layout.svelte @@ -0,0 +1,77 @@ + + +
    +
    + + +
    +
    + + diff --git a/src/routes/etf/[tickerID]/forecast/+page.server.ts b/src/routes/etf/[tickerID]/forecast/+page.server.ts new file mode 100644 index 00000000..c3096e0e --- /dev/null +++ b/src/routes/etf/[tickerID]/forecast/+page.server.ts @@ -0,0 +1,54 @@ +export const load = async ({ locals, params }) => { + const { apiURL, apiKey } = locals; + const postData = { + ticker: params.tickerID, + }; + const getAnalystInsight = async () => { + const response = await fetch(apiURL + "/analyst-insight", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + const getPriceAnalysis = async () => { + const response = await fetch(apiURL + "/price-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + const getSentimentAnalysis = async () => { + const response = await fetch(apiURL + "/sentiment-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + // Make sure to return a promise + return { + getAnalystInsight: await getAnalystInsight(), + getPriceAnalysis: await getPriceAnalysis(), + getSentimentAnalysis: await getSentimentAnalysis(), + }; +}; diff --git a/src/routes/etf/[tickerID]/forecast/+page.svelte b/src/routes/etf/[tickerID]/forecast/+page.svelte new file mode 100644 index 00000000..2f1f00c9 --- /dev/null +++ b/src/routes/etf/[tickerID]/forecast/+page.svelte @@ -0,0 +1,63 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$stockTicker}) Forecast AI · stocknear + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + +
    +
    + + +
    + +
    +
    + + + +
    + +
    +
    +
    +
    +
    +
    diff --git a/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts b/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts index 658b0492..c3096e0e 100644 --- a/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts +++ b/src/routes/stocks/[tickerID]/forecast/ai/+page.server.ts @@ -1,13 +1,10 @@ export const load = async ({ locals, params }) => { - const getAnalystTickerHistory = async () => { - const { apiURL, apiKey } = locals; - - const postData = { - ticker: params.tickerID, - }; - - // make the POST request to the endpoint - const response = await fetch(apiURL + "/analyst-ticker-history", { + const { apiURL, apiKey } = locals; + const postData = { + ticker: params.tickerID, + }; + const getAnalystInsight = async () => { + const response = await fetch(apiURL + "/analyst-insight", { method: "POST", headers: { "Content-Type": "application/json", @@ -17,12 +14,41 @@ export const load = async ({ locals, params }) => { }); const output = await response.json(); + return output; + }; + const getPriceAnalysis = async () => { + const response = await fetch(apiURL + "/price-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); + return output; + }; + + const getSentimentAnalysis = async () => { + const response = await fetch(apiURL + "/sentiment-analysis", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + const output = await response.json(); return output; }; // Make sure to return a promise return { - getAnalystTickerHistory: await getAnalystTickerHistory(), + getAnalystInsight: await getAnalystInsight(), + getPriceAnalysis: await getPriceAnalysis(), + getSentimentAnalysis: await getSentimentAnalysis(), }; }; diff --git a/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte b/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte index abe27a5d..2f1f00c9 100644 --- a/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte +++ b/src/routes/stocks/[tickerID]/forecast/ai/+page.svelte @@ -1,8 +1,6 @@