From 7a0bec75de608b3ec0dc26f3d9e273ef0759fdfa Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 28 Feb 2025 14:13:00 +0100 Subject: [PATCH] update chart --- .../DarkPool/HistoricalVolume.svelte | 501 +++++++++++------- src/lib/components/FailToDeliver.svelte | 35 +- .../etf/[tickerID]/dark-pool/+page.svelte | 7 +- .../stocks/[tickerID]/dark-pool/+page.svelte | 8 +- 4 files changed, 321 insertions(+), 230 deletions(-) diff --git a/src/lib/components/DarkPool/HistoricalVolume.svelte b/src/lib/components/DarkPool/HistoricalVolume.svelte index 078d75c8..bb8730a0 100644 --- a/src/lib/components/DarkPool/HistoricalVolume.svelte +++ b/src/lib/components/DarkPool/HistoricalVolume.svelte @@ -1,18 +1,23 @@ @@ -166,7 +247,7 @@ for="historicalDataInfo" class="mr-1 cursor-pointer flex flex-row items-center text-white text-xl sm:text-2xl font-bold" > - Historical Activity + Historical Chart -
-
- +
+ +
+

+ Dark Pool Table +

+ +
+
+ {#each tabs as item, i} + {#if data?.user?.tier !== "Pro" && i > 0} + + {:else} + + {/if} + {/each} +
-
-
- - - - Total Volume - -
-
- - - - Short Volume - -
-
- -

- Latest Information -

- -
+
+ + + + + + + + - - - Date - - - - - - - - - - - + + + + + + + + + {/each}
DateTotal VolumeShort Volume% Short Volume Change
+
- {formatDateRange(rawData?.slice(-1)?.at(0)?.date)} -
- Total Volume - - {monthlyVolume} -
- Avg. Short % of Volume - - {avgMonthlyShort}% -
+ {new Date(item?.date)?.toLocaleDateString("en-US", { + day: "2-digit", // Include day number + month: "short", // Display short month name + year: "numeric", // Include year + })} + + {item?.totalVolume} + + {abbreviateNumber(item?.shortVolume)} + + {#if index === tableList?.length - 1} + n/a + {:else if item?.shortVolume > tableList[index + 1]?.shortVolume} + + +{( + ((item?.shortVolume - + tableList[index + 1]?.shortVolume) / + tableList[index + 1]?.shortVolume) * + 100 + )?.toFixed(2)}% + + {:else if item?.shortVolume < tableList[index + 1]?.shortVolume} + + -{( + Math.abs( + (item?.shortVolume - + tableList[index + 1]?.shortVolume) / + tableList[index + 1]?.shortVolume, + ) * 100 + )?.toFixed(2)}% + + {:else} + n/a + {/if} +
{/if} - - diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index f0899cf3..821a3f48 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -5,11 +5,7 @@ assetType, etfTicker, } from "$lib/store"; - import { - abbreviateNumber, - monthNames, - removeCompanyStrings, - } from "$lib/utils"; + import { abbreviateNumber, removeCompanyStrings } from "$lib/utils"; import { goto } from "$app/navigation"; import highcharts from "$lib/highcharts.ts"; @@ -158,21 +154,25 @@ }, }, xAxis: { + endOnTick: false, categories: dates, crosshair: { color: "#fff", // Set the color of the crosshair line width: 1, // Adjust the line width as needed dashStyle: "Solid", }, + labels: { style: { color: "#fff", }, + distance: 20, // Increases space between label and axis formatter: function () { - const dateParts = this.value.split("-"); - const day = dateParts[2].substring(0); - const monthIndex = parseInt(dateParts[1], 10) - 1; - return `${day} ${monthNames[monthIndex]}`; + return new Date(this.value).toLocaleDateString("en-US", { + day: "2-digit", // Include day number + month: "short", // Display short month name + year: "numeric", // Include year + }); }, }, }, @@ -409,20 +409,3 @@ {/if} - - diff --git a/src/routes/etf/[tickerID]/dark-pool/+page.svelte b/src/routes/etf/[tickerID]/dark-pool/+page.svelte index 2854a40b..8c03d06d 100644 --- a/src/routes/etf/[tickerID]/dark-pool/+page.svelte +++ b/src/routes/etf/[tickerID]/dark-pool/+page.svelte @@ -58,11 +58,10 @@ {#if hottestTrades?.length > 0} {/if} + {#if historicalDarkPool?.length > 10} + + {/if} {#if data?.user?.tier === "Pro"} - {#if historicalDarkPool?.length > 10} - - {/if} - {:else} {/if}
diff --git a/src/routes/stocks/[tickerID]/dark-pool/+page.svelte b/src/routes/stocks/[tickerID]/dark-pool/+page.svelte index a33361e3..558cd5c7 100644 --- a/src/routes/stocks/[tickerID]/dark-pool/+page.svelte +++ b/src/routes/stocks/[tickerID]/dark-pool/+page.svelte @@ -58,11 +58,11 @@ {#if hottestTrades?.length > 0} {/if} + + {#if historicalDarkPool?.length > 10} + + {/if} {#if data?.user?.tier === "Pro"} - {#if historicalDarkPool?.length > 10} - - {/if} - {:else} {/if}