This commit is contained in:
MuslemRahimi 2024-10-28 23:22:35 +01:00
parent 0f30b395c8
commit 7e073b1fc3
4 changed files with 102 additions and 105 deletions

1
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -12,7 +12,6 @@ export const load = async ({ locals, setHeaders }) => {
});
let output = await response.json();
console.log(output);
output = user?.tier !== "Pro" ? output?.reverse()?.slice(0, 6) : output;
setHeaders({ "cache-control": "public, max-age=200" });

View File

@ -11,38 +11,41 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/market-cap/mega-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Mega-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg">Mega-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/market-cap/large-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Large-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg"
>Large-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/market-cap/mid-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Mid-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg">Mid-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/market-cap/small-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Small-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg"
>Small-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/market-cap/micro-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Micro-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg"
>Micro-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/market-cap/nano-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Nano-Cap Stocks</a
class="sm:hover:text-white text-blue-400 text-lg">Nano-Cap Stocks</a
>
</li>
</ul>
@ -53,20 +56,22 @@
<ul class="list-disc space-y-1 pl-5">
<li class="mb-2 cursor-pointer">
<a
href="/list/small-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Small-Cap Stocks</a
href="/list/market-cap/small-cap-stocks"
class="sm:hover:text-white text-blue-400 text-lg"
>Small-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/micro-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Micro-Cap Stocks</a
href="/list/market-cap/micro-cap-stocks"
class="sm:hover:text-white text-blue-400 text-lg"
>Micro-Cap Stocks</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/nano-cap-stocks"
class="hover:text-white text-blue-400 text-lg">Nano-Cap Stocks</a
href="/list/market-cap/nano-cap-stocks"
class="sm:hover:text-white text-blue-400 text-lg">Nano-Cap Stocks</a
>
</li>
<!-- ...other list items -->
@ -89,25 +94,26 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/nasdaq-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on NASDAQ</a
class="sm:hover:text-white text-blue-400 text-lg"
>Listed on NASDAQ</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/nyse-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on NYSE</a
class="sm:hover:text-white text-blue-400 text-lg">Listed on NYSE</a
>
</li>
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/amex-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on AMEX</a
class="sm:hover:text-white text-blue-400 text-lg">Listed on AMEX</a
>
</li>
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/xetra-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on XETRA</a
class="sm:hover:text-white text-blue-400 text-lg">Listed on XETRA</a
>
</li>
</ul>
@ -119,13 +125,13 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/amex-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on AMEX</a
class="sm:hover:text-white text-blue-400 text-lg">Listed on AMEX</a
>
</li>
<li class="mb-2 cursor-pointer">
<a
href="/list/xetra-stocks"
class="hover:text-white text-blue-400 text-lg">Listed on XETRA</a
class="sm:hover:text-white text-blue-400 text-lg">Listed on XETRA</a
>
</li>
<!-- ...other list items -->
@ -148,7 +154,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/dow-jones-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Listed on Dow Jones
</a>
@ -156,7 +162,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/nasdaq-100-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Listed on NASDAQ 100
</a>
@ -164,7 +170,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/sp-500-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Listed on S&P 500
</a>
@ -178,7 +184,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/sp-500-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Listed on S&P 500
</a>
@ -203,7 +209,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/canadian-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Canada
</a>
@ -211,7 +217,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/chinese-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
China
</a>
@ -219,7 +225,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/indian-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
India
</a>
@ -227,7 +233,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/japanese-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Japan
</a>
@ -236,7 +242,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/german-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Germany
</a>
@ -244,7 +250,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/israeli-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Israel
</a>
@ -252,7 +258,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/uk-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
United Kingdom
</a>
@ -265,7 +271,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/german-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Germany
</a>
@ -273,7 +279,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/israeli-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Israel
</a>
@ -281,7 +287,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/uk-stocks-us"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
United Kingdom
</a>
@ -304,7 +310,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/financial-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Financials
</a>
@ -312,7 +318,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/healthcare-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Healthcare
</a>
@ -320,7 +326,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/technology-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Technology
</a>
@ -328,7 +334,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/industrials-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Industrials
</a>
@ -336,7 +342,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/energy-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Energy
</a>
@ -344,7 +350,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/utilities-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Utilities
</a>
@ -353,7 +359,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/consumer-cyclical-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Consumer Cyclical
</a>
@ -361,7 +367,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/real-estate-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Real Estate
</a>
@ -369,7 +375,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/basic-materials-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Basic Materials
</a>
@ -377,7 +383,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/communication-services-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Communication Services
</a>
@ -385,7 +391,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/consumer-defensive-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Consumer Defensive
</a>
@ -399,7 +405,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/consumer-cyclical-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Consumer Cyclical
</a>
@ -407,7 +413,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/real-estate-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Real Estate
</a>
@ -415,7 +421,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/basic-materials-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Basic Materials
</a>
@ -423,7 +429,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/communication-services-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Communication Services
</a>
@ -431,7 +437,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/consumer-defensive-sector"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Consumer Defensive
</a>
@ -453,7 +459,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/etf/new-launches"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
New Launches
</a>
@ -461,7 +467,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/etf/etf-providers"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
ETF Providers
</a>
@ -469,7 +475,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/bitcoin-etfs"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Bitcoin ETFs
</a>
@ -483,7 +489,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/bitcoin-etfs"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Bitcoin ETFs
</a>
@ -506,7 +512,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/magnificent-seven"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Magnificent Seven
</a>
@ -514,7 +520,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/dividend-kings"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Dividend Kings
</a>
@ -522,7 +528,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/dividend-aristocrats"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Dividend Aristocrats
</a>
@ -530,7 +536,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/reit-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
All REITs
</a>
@ -538,7 +544,7 @@
<li class="mb-2 cursor-pointer sm:hidden">
<a
href="/list/delisted-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Delisted Companies
</a>
@ -552,7 +558,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/reit-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
All REITs
</a>
@ -560,7 +566,7 @@
<li class="mb-2 cursor-pointer">
<a
href="/list/delisted-stocks"
class="hover:text-white text-blue-400 text-lg"
class="sm:hover:text-white text-blue-400 text-lg"
>
Delisted Companies
</a>

View File

@ -42,7 +42,7 @@
let stockDeck = {};
$: previousClose = data?.getStockQuote?.previousClose;
let latestChangePercentage = 0;
//============================================//
const intervals = ["1D", "1W", "1M", "1Y", "MAX"];
@ -77,11 +77,21 @@
if (!$isCrosshairMoveActive && $realtimePrice !== null) {
change = (($realtimePrice / previousClose - 1) * 100)?.toFixed(2);
} else {
change = (
latestChangePercentage = (
((currentDataRow?.close ?? currentDataRow?.value) / previousClose -
1) *
100
)?.toFixed(2);
change =
displayData === "1D"
? latestChangePercentage
: (
((currentDataRow?.close ?? currentDataRow?.value) /
displayLastLogicalRangeValue -
1) *
100
)?.toFixed(2);
}
const date = new Date(currentDataRow?.time * 1000);
@ -96,14 +106,24 @@
};
//const formattedDate = (displayData === '1D' || displayData === '1W' || displayData === '1M') ? date.toLocaleString('en-GB', options).replace(/\//g, '.') : date.toLocaleDateString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric' }).replace(/\//g, '.');
const formattedDate = date?.toLocaleString("en-US", options);
const formattedDate =
displayData === "1D" || displayData === "1W" || displayData === "1M"
? date.toLocaleString("en-US", options)
: date.toLocaleDateString("en-US", {
day: "2-digit",
month: "short",
year: "numeric",
});
const safeFormattedDate =
formattedDate === "Invalid Date"
? convertTimestamp(data?.getStockQuote?.timestamp)
: formattedDate;
displayLegend = {
close: data?.getStockQuote?.price?.toFixed(2),
close:
currentDataRow?.value === "-" && currentDataRow?.close === undefined
? data?.getStockQuote?.price
: (currentDataRow?.close ?? currentDataRow?.value),
date: safeFormattedDate,
change: change,
};
@ -791,45 +811,12 @@
</div>
<div class="flex flex-row items-center w-full">
{#if displayLegend?.change >= 0}
<svg
class="inline-block w-5 h-5 mt-0.5 -mr-0.5"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
><g id="evaArrowUpFill0"
><g id="evaArrowUpFill1"
><path
id="evaArrowUpFill2"
fill="#00FC50"
d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1Z"
/></g
></g
></svg
>
<span
class="items-center justify-start text-[#00FC50] font-medium text-xs sm:text-sm"
>+{displayLegend?.change}%</span
>
{:else if displayLegend?.change < 0}
<svg
class="inline-block w-5 h-5 mt-0.5 -mr-0.5 rotate-180"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
><g id="evaArrowUpFill0"
><g id="evaArrowUpFill1"
><path
id="evaArrowUpFill2"
fill="#FF2F1F"
d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1Z"
/></g
></g
></svg
>
<span
class="items-center justify-start text-[#FF2F1F] font-medium text-xs sm:text-sm"
>{displayLegend?.change}%
</span>
{/if}
<span
class="items-center justify-start {latestChangePercentage > 0
? "before:content-['+'] text-[#00FC50]"
: 'text-[#FF2F1F]'} font-medium text-xs sm:text-sm"
>{latestChangePercentage}%</span
>
<span class="ml-3 text-white text-xs sm:text-sm"
>{displayLegend?.date}</span
@ -1357,7 +1344,9 @@
>
<td
class="whitespace-nowrap px-0.5 py-[1px] text-left text-smaller font-semibold tiny:text-base xs:px-1 sm:py-2 sm:text-right sm:text-small"
>{stockDeck?.shortOutStandingPercent}%</td
>{stockDeck?.shortOutStandingPercent !== null
? stockDeck?.shortOutStandingPercent + "%"
: "n/a"}</td
></tr
>
</tbody>
@ -1471,7 +1460,9 @@
>
<td
class="whitespace-nowrap px-0.5 py-[1px] text-left text-smaller font-semibold tiny:text-base xs:px-1 sm:py-2 sm:text-right sm:text-small"
>{stockDeck?.shortFloatPercent}%</td
>{stockDeck?.shortFloatPercent !== null
? stockDeck?.shortFloatPercent + "%"
: "n/a"}</td
></tr
>
</tbody>