bugfixing options flow

This commit is contained in:
MuslemRahimi 2025-02-26 21:28:56 +01:00
parent 6c47c6fbac
commit b3e96b68b2
2 changed files with 46 additions and 67 deletions

View File

@ -1,11 +1,6 @@
<script lang="ts"> <script lang="ts">
import notifySound from "$lib/audio/options-flow-reader.mp3"; import notifySound from "$lib/audio/options-flow-reader.mp3";
import { import { getCache, setCache, isOpen } from "$lib/store";
numberOfUnreadNotification,
getCache,
setCache,
isOpen,
} from "$lib/store";
import { cn, sectorList } from "$lib/utils"; import { cn, sectorList } from "$lib/utils";
import { onMount, onDestroy } from "svelte"; import { onMount, onDestroy } from "svelte";
@ -18,6 +13,7 @@
import UpgradeToPro from "$lib/components/UpgradeToPro.svelte"; import UpgradeToPro from "$lib/components/UpgradeToPro.svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import SEO from "$lib/components/SEO.svelte";
import DarkPoolTable from "$lib/components/Table/DarkPoolTable.svelte"; import DarkPoolTable from "$lib/components/Table/DarkPoolTable.svelte";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
@ -694,38 +690,12 @@
} }
</script> </script>
<svelte:head> <SEO
<meta charset="utf-8" /> title="Dark
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" /> Pool Flow Feed"
description="Explore unusual dark pool trades from big institutional traders and hedge funds."
<title>
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} Dark
Pool Flow Feed · Stocknear
</title>
<meta
name="description"
content={`Explore unusual dark pool trades from big institutional traders and hedge funds.`}
/> />
<!-- Other meta tags -->
<meta property="og:title" content={`Dark Pool Flow · Stocknear`} />
<meta
property="og:description"
content={`Explore unusual dark pool trades from big institutional traders and hedge funds.`}
/>
<meta property="og:type" content="website" />
<!-- Add more Open Graph meta tags as needed -->
<!-- Twitter specific meta tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={`Dark Pool Flow · Stocknear`} />
<meta
name="twitter:description"
content={`Explore unusual dark pool trades from big institutional traders and hedge funds.`}
/>
<!-- Add more Twitter meta tags as needed -->
</svelte:head>
<body class="overflow-y-auto"> <body class="overflow-y-auto">
<section <section
class="w-full max-w-screen sm:max-w-7xl sm:max-w-[1400px] flex justify-center items-center bg-default pb-20 mt-5 sm:mt-0 px-3 sm:px-0" class="w-full max-w-screen sm:max-w-7xl sm:max-w-[1400px] flex justify-center items-center bg-default pb-20 mt-5 sm:mt-0 px-3 sm:px-0"
@ -744,7 +714,7 @@
<div <div
class="text-white text-sm sm:text-[1rem] italic text-center sm:text-start w-full ml-2 mb-3" class="text-white text-sm sm:text-[1rem] italic text-center sm:text-start w-full ml-2 mb-3"
> >
Live flow of {data?.user?.tier === "Pro" && selectedDate Dark Pool Live flow of {data?.user?.tier === "Pro" && selectedDate
? df.format(selectedDate?.toDate()) ? df.format(selectedDate?.toDate())
: nyseDate} (NYSE Time) : nyseDate} (NYSE Time)
</div> </div>

View File

@ -229,7 +229,8 @@
function handleAddRule() { function handleAddRule() {
if (ruleName === "") { if (ruleName === "") {
toast.error("Please select a rule", { toast.error("Please select a rule", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
return; return;
} }
@ -468,14 +469,9 @@
new Date().toLocaleString("en-US", { timeZone: "America/New_York" }), new Date().toLocaleString("en-US", { timeZone: "America/New_York" }),
)?.getTime(); )?.getTime();
const nyseDate = new Date( const dateString = data?.getOptionsFlowFeed?.at(0)?.date;
data?.getOptionsFlowFeed?.at(0)?.date ?? null, const nyseDate = new Date(`${dateString}T12:00:00Z`);
)?.toLocaleString("en-US", { const formattedNyseDate = nyseDate.toISOString().split("T")[0];
month: "short",
day: "numeric",
year: "numeric",
timeZone: "Europe/Berlin",
});
let rawData = data?.getOptionsFlowFeed?.filter((item) => let rawData = data?.getOptionsFlowFeed?.filter((item) =>
Object?.values(item)?.every( Object?.values(item)?.every(
@ -520,7 +516,8 @@
} }
} else { } else {
toast.error(`Market is closed`, { toast.error(`Market is closed`, {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
} }
@ -749,8 +746,18 @@
const year = convertDate?.getFullYear(); const year = convertDate?.getFullYear();
const month = String(convertDate?.getMonth() + 1).padStart(2, "0"); const month = String(convertDate?.getMonth() + 1).padStart(2, "0");
const day = String(convertDate?.getDate()).padStart(2, "0"); const day = String(convertDate?.getDate()).padStart(2, "0");
const formattedDate = `${year}-${month}-${day}`;
const postData = { selectedDate: `${year}-${month}-${day}` }; if (formattedDate === formattedNyseDate) {
rawData = data?.getOptionsFlowFeed;
if (rawData?.length !== 0) {
rawData?.forEach((item) => {
item.dte = daysLeft(item?.date_expiration);
});
shouldLoadWorker.set(true);
}
} else {
const postData = { selectedDate: formattedDate };
try { try {
const response = await fetch("/api/options-historical-flow", { const response = await fetch("/api/options-historical-flow", {
@ -774,9 +781,11 @@
} finally { } finally {
isLoaded = true; isLoaded = true;
} }
}
} else { } else {
toast.error("Only for Pro Members", { toast.error("Only for Pro Members", {
style: "border-radius: 200px; background: #2A2E39; color: #fff;", style:
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
}); });
} }
}; };
@ -845,7 +854,7 @@
<div <div
class="text-white text-sm sm:text-[1rem] italic text-center sm:text-start w-full ml-2 mb-3" class="text-white text-sm sm:text-[1rem] italic text-center sm:text-start w-full ml-2 mb-3"
> >
Live flow of {data?.user?.tier === "Pro" && selectedDate Options Live flow of {data?.user?.tier === "Pro" && selectedDate
? df.format(selectedDate?.toDate()) ? df.format(selectedDate?.toDate())
: nyseDate} (NYSE Time) : nyseDate} (NYSE Time)
</div> </div>