bugfixing options flow
This commit is contained in:
parent
6c47c6fbac
commit
b3e96b68b2
@ -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,37 +690,11 @@
|
|||||||
}
|
}
|
||||||
</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
|
||||||
@ -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>
|
||||||
|
|||||||
@ -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,34 +746,46 @@
|
|||||||
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;
|
||||||
try {
|
|
||||||
const response = await fetch("/api/options-historical-flow", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify(postData),
|
|
||||||
});
|
|
||||||
|
|
||||||
rawData = await response?.json();
|
|
||||||
if (rawData?.length !== 0) {
|
if (rawData?.length !== 0) {
|
||||||
rawData?.forEach((item) => {
|
rawData?.forEach((item) => {
|
||||||
item.dte = daysLeft(item?.date_expiration);
|
item.dte = daysLeft(item?.date_expiration);
|
||||||
});
|
});
|
||||||
shouldLoadWorker.set(true);
|
shouldLoadWorker.set(true);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} else {
|
||||||
console.error("Error fetching historical flow:", error);
|
const postData = { selectedDate: formattedDate };
|
||||||
rawData = [];
|
|
||||||
} finally {
|
try {
|
||||||
isLoaded = true;
|
const response = await fetch("/api/options-historical-flow", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(postData),
|
||||||
|
});
|
||||||
|
|
||||||
|
rawData = await response?.json();
|
||||||
|
if (rawData?.length !== 0) {
|
||||||
|
rawData?.forEach((item) => {
|
||||||
|
item.dte = daysLeft(item?.date_expiration);
|
||||||
|
});
|
||||||
|
shouldLoadWorker.set(true);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching historical flow:", error);
|
||||||
|
rawData = [];
|
||||||
|
} finally {
|
||||||
|
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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user