diff --git a/src/lib/components/ShareHolders.svelte b/src/lib/components/ShareHolders.svelte index b772d389..b63c8af5 100644 --- a/src/lib/components/ShareHolders.svelte +++ b/src/lib/components/ShareHolders.svelte @@ -1,7 +1,7 @@ + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ''} High Short Interest Stocks · stocknear + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+
+
+ +
+
+ + +
+
+

+ Most Shorted Stocks +

+
+ + + High short interest stocks are often volatile, known for sudden price surges called short squeezes. + + + +
+ + + + + +
+ + + + +
+ + {#if isLoaded} +
+ +
+ + + + + + + + + + + + + + + + {#each shortedList as item, index} + + goto(`/stocks/${item?.symbol}`)} class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] {index % 2 === 0 ? 'bg-[#202020]' : 'bg-[#0F0F0F]'} border-b-[#0F0F0F] cursor-pointer"> + + + + + + + + + + + + + + + + + + {/each} + +
+ # + + Symbol + + Short Interest + + Float + + Outstd + + Sector +
+ {index+1} + +
+ {item?.symbol} + + {item?.name?.length > charNumber ? item?.name?.slice(0,charNumber) + "..." : item?.name} + +
+
+ {item?.shortOutStandingPercent}% + + {abbreviateNumber(item?.latestFloatShares)} + + {abbreviateNumber(item?.latestOutstandingShares)} + + {item?.sector} +
+
+ + + +
+ + {:else} +
+
+ +
+
+ {/if} + + +
+
+
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/src/routes/most-shorted-stocks/+page.ts b/src/routes/most-shorted-stocks/+page.ts new file mode 100644 index 00000000..05e0afac --- /dev/null +++ b/src/routes/most-shorted-stocks/+page.ts @@ -0,0 +1,48 @@ +import { userRegion, getCache, setCache } from '$lib/store'; + + +const usRegion = ['cle1','iad1','pdx1','sfo1']; + +let apiURL; + +userRegion.subscribe(value => { + + if (usRegion.includes(value)) { + apiURL = import.meta.env.VITE_USEAST_API_URL; + } else { + apiURL = import.meta.env.VITE_EU_API_URL; + } +}); + + +export const load = async ({parent}) => { + const getMostShortedStocks = async () => { + let output; + const data = await parent(); + + const cachedData = getCache('', 'getMostShortedStocks'); + if (cachedData) { + output = cachedData; + } else { + // make the POST request to the endpoint + const response = await fetch(apiURL + '/most-shorted-stocks', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + }); + + output = await response.json(); + + setCache('', output, 'getMostShortedStocks'); + + } + + return output; + }; + + // Make sure to return a promise + return { + getMostShortedStocks: await getMostShortedStocks() + }; +}; \ No newline at end of file diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index c3aed9c1..5f5fcce6 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -18,6 +18,7 @@ export const config = { const pages = [ {title: "/"}, + {title: "/most-shorted-stocks"}, {title: "/stocks"}, {title: "/etf"}, {title: "/crypto"}, diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index 891f322b..ec3c83e3 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -3,7 +3,7 @@ import {AreaSeries, Chart, PriceLine, CandlestickSeries} from 'svelte-lightweight-charts'; import { TrackingModeExitMode } from 'lightweight-charts'; - import {screenWidth, displayCompanyName, numberOfUnreadNotification, globalForm, trendAnalysisComponent, revenueSegmentationComponent, priceAnalysisComponent, fundamentalAnalysisComponent, userRegion, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, clientSideCache, stockTicker, isOpen, isBeforeMarketOpen, isWeekend} from '$lib/store'; + import {screenWidth, displayCompanyName, numberOfUnreadNotification, globalForm, shareholderComponent, trendAnalysisComponent, revenueSegmentationComponent, priceAnalysisComponent, fundamentalAnalysisComponent, userRegion, isCrosshairMoveActive, realtimePrice, priceIncrease, currentPortfolioPrice, currentPrice, clientSideCache, stockTicker, isOpen, isBeforeMarketOpen, isWeekend} from '$lib/store'; import { onDestroy, onMount } from 'svelte'; import StockKeyInformation from '$lib/components/StockKeyInformation.svelte'; import BullBearSay from '$lib/components/BullBearSay.svelte'; @@ -1281,7 +1281,7 @@ function changeChartType() { -
+
{#await import('$lib/components/ShareHolders.svelte') then {default: Comp}} {/await}