diff --git a/src/lib/components/Options/UnusualActivity.svelte b/src/lib/components/Options/UnusualActivity.svelte new file mode 100644 index 00000000..317a5c99 --- /dev/null +++ b/src/lib/components/Options/UnusualActivity.svelte @@ -0,0 +1,247 @@ + + +
+
+
+
+

+ Unusual Activity +

+
+ + + + + + {#each displayList as item, index} + + + + + + + + + + + + + + + {/each} + +
+ {formatDate(item?.date)} + + {item?.dte} + + {item?.optionType} + + {item?.unusualType} + + {item?.sentiment} + + {item?.size?.toLocaleString("en-US")} + + {item?.strike} + + {item?.avgPrice} + + {item?.price} + + {@html abbreviateNumberWithColor( + item?.premium, + false, + true, + )} +
+
+ + +
+
+
+
+ + diff --git a/src/routes/stocks/[tickerID]/options/+layout.svelte b/src/routes/stocks/[tickerID]/options/+layout.svelte index 80e9e4b4..55125d18 100644 --- a/src/routes/stocks/[tickerID]/options/+layout.svelte +++ b/src/routes/stocks/[tickerID]/options/+layout.svelte @@ -11,6 +11,7 @@ const subSectionMap = { overview: "/options", "hottest-contracts": "/options/hottest-contracts", + "unusual-activity": "/options/unusual-activity", volatility: "/options/volatility", gex: "/options/gex", dex: "/options/dex", @@ -32,6 +33,7 @@ const sectionMap = { overview: "overview", "hottest-contracts": "hottest-contracts", + "unusual-activity": "unusual-activity", volatility: "volatility", gex: "gex", dex: "dex", @@ -70,7 +72,16 @@ > Overview - + changeSubSection("unusual-activity")} + class="p-2 px-5 cursor-pointer {displaySubSection === + 'unusual-activity' + ? 'text-white bg-primary sm:hover:bg-opacity-[0.95]' + : 'text-gray-400 sm:hover:text-white sm:hover:bg-primary sm:hover:bg-opacity-[0.95]'}" + > + Unusual Activity + changeSubSection("hottest-contracts")} diff --git a/src/routes/stocks/[tickerID]/options/unusual-activity/+page.server.ts b/src/routes/stocks/[tickerID]/options/unusual-activity/+page.server.ts new file mode 100644 index 00000000..18e906f5 --- /dev/null +++ b/src/routes/stocks/[tickerID]/options/unusual-activity/+page.server.ts @@ -0,0 +1,33 @@ + + +export const load = async ({ locals, params }) => { + const { apiKey, apiURL, user } = locals; + + const getData = async () => { + const postData = { + ticker: params.tickerID, + }; + + const response = await fetch(apiURL + "/unusual-activity", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + + let output = await response.json(); + + return output; + }; + + + + // Make sure to return a promise + return { + getData: await getData(), + }; +}; + + diff --git a/src/routes/stocks/[tickerID]/options/unusual-activity/+page.svelte b/src/routes/stocks/[tickerID]/options/unusual-activity/+page.svelte new file mode 100644 index 00000000..40accf19 --- /dev/null +++ b/src/routes/stocks/[tickerID]/options/unusual-activity/+page.svelte @@ -0,0 +1,37 @@ + + + + +
+
+
+ {#if data?.getData?.length > 0} + + {:else} +
+
+ +
+
+ {/if} +
+
+