diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index 2f39811d..02a71e7b 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -1,13 +1,9 @@ + +
+
+
+
+
+ +
+ + +
+
+
+
diff --git a/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.server.ts b/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.server.ts new file mode 100644 index 00000000..9e5f902a --- /dev/null +++ b/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.server.ts @@ -0,0 +1,29 @@ +export const load = async ({ locals, params }) => { + const getData = async () => { + const { apiKey, apiURL } = locals; + const postData = { + ticker: params.tickerID, + }; + + // make the POST request to the endpoint + const response = await fetch(apiURL + "/fail-to-deliver", { + 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 { + getData: await getData(), + }; +}; diff --git a/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.svelte b/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.svelte new file mode 100644 index 00000000..940aa15f --- /dev/null +++ b/src/routes/stocks/[tickerID]/statistics/fail-to-deliver/+page.svelte @@ -0,0 +1,195 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$stockTicker}) Fail-to-Deliver Shares · Stocknear + + + + + + + + + + +
+
+
+ {#if isLoaded} +
+
+
+

+ Fail-to-Deliver (FTD) +

+
+ + {#if rawData?.length !== 0} +
+
+
+
+
+ FTD Shares +
+
+ {abbreviateNumber( + rawData?.slice(-1)?.at(0)?.failToDeliver, + false, + )} +
+
+
+
+
+
+ FTD / Avg Volume +
+
+ {data?.getStockQuote?.avgVolume > 0 + ? ( + (rawData?.slice(-1)?.at(0)?.failToDeliver / + data?.getStockQuote?.avgVolume) * + 100 + )?.toFixed(2) + "%" + : "n/a"} +
+
+
+
+
+
+ 1-Year Change +
+
+ {changePercentageYearAgo !== null + ? abbreviateNumber( + changePercentageYearAgo?.toFixed(2), + ) + "%" + : "n/a"} +
+
+
+
+ + +
+ {:else} +

+ No data available +

+ {/if} +
+
+ {:else} +
+
+ +
+
+ {/if} +
+
+
diff --git a/src/routes/stocks/[tickerID]/statistics/market-cap/+page.svelte b/src/routes/stocks/[tickerID]/statistics/market-cap/+page.svelte index 2f52f823..491fedab 100644 --- a/src/routes/stocks/[tickerID]/statistics/market-cap/+page.svelte +++ b/src/routes/stocks/[tickerID]/statistics/market-cap/+page.svelte @@ -318,15 +318,33 @@ color: "#fff", // Optional: Text color for better visibility }, formatter: function (params) { - const date = params[0].name; // Get the date from the x-axis value - const dateParts = date.split("-"); - const year = dateParts[0]; - const monthIndex = parseInt(dateParts[1]) - 1; - const day = dateParts[2]; - const formattedDate = `${monthNames[monthIndex]} ${day}, ${year}`; + // Get the timestamp from the first parameter + const timestamp = params[0].axisValue; - // Return the tooltip content - return `${formattedDate}
${abbreviateNumber(params[0].value)}`; + // Initialize result with timestamp + let result = timestamp + "
"; + + // Add each series data + params.forEach((param) => { + const marker = + ''; + result += + marker + + param.seriesName + + ": " + + abbreviateNumber(param.value, false, true) + + "
"; + }); + + return result; + }, + axisPointer: { + lineStyle: { + color: "#fff", + }, }, }, }; @@ -439,7 +457,7 @@ >
-
+
Market Cap
-
Category
+
+ Category +
@@ -474,7 +494,7 @@
-
+
1-Year Change