diff --git a/src/routes/etf/[tickerID]/options/+layout.svelte b/src/routes/etf/[tickerID]/options/+layout.svelte index afcd462a..95c83e60 100644 --- a/src/routes/etf/[tickerID]/options/+layout.svelte +++ b/src/routes/etf/[tickerID]/options/+layout.svelte @@ -17,10 +17,10 @@ if (state !== "overview" && subSectionMap[state]) { displaySubSection = state; - //goto(`/stocks/${$etfTicker}${subSectionMap[state]}`); + //goto(`/etf/${$etfTicker}${subSectionMap[state]}`); } else { displaySubSection = state; - //goto(`/stocks/${$etfTicker}/statistics`); + //goto(`/etf/${$etfTicker}/statistics`); } } @@ -157,7 +157,7 @@ - Build your Stock Screener to find profitable stocks. + Build your Stock Screener to find profitable etf. diff --git a/src/routes/etf/[tickerID]/options/dex/+layout.svelte b/src/routes/etf/[tickerID]/options/dex/+layout.svelte new file mode 100644 index 00000000..f87fa854 --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/+layout.svelte @@ -0,0 +1,94 @@ + + +
+ +
diff --git a/src/routes/etf/[tickerID]/options/dex/+page.server.ts b/src/routes/etf/[tickerID]/options/dex/+page.server.ts new file mode 100644 index 00000000..a6db54dc --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/+page.server.ts @@ -0,0 +1,50 @@ + + +export const load = async ({ locals, params }) => { + const { apiKey, apiURL, user } = locals; + + const getData = async () => { + const postData = { + params: params.tickerID, + category: "overview" + }; + + const response = await fetch(apiURL + "/options-gex-dex", { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-API-KEY": apiKey, + }, + body: JSON.stringify(postData), + }); + const output = await response.json(); + + return output; + }; + + + const getHistoricalPrice = async () => { + const postData = { ticker: params.tickerID, timePeriod: "one-year" }; + const response = await fetch(apiURL + "/historical-price", { + 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(), + getHistoricalPrice: await getHistoricalPrice(), + }; +}; + + diff --git a/src/routes/etf/[tickerID]/options/dex/+page.svelte b/src/routes/etf/[tickerID]/options/dex/+page.svelte new file mode 100644 index 00000000..c7ad0d07 --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/+page.svelte @@ -0,0 +1,525 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$stockTicker}) Gamma Exposure · Stocknear + + + + + + + + + + + + + + + + +
+
+
+ {#if rawData?.length > 0} +
+

+ Daily Delta Exposure +

+ +
+ {#if options !== null} +
+
+ {#each ["3M", "6M", "1Y"] as item} + + {/each} +
+ + +
+ {:else} +
+
+ +
+
+ {/if} +
+
+ + + + + + {#each displayList as item, index} + + + + + + + + + + {/each} + +
+ {formatDate(item?.date)} + + {@html abbreviateNumberWithColor( + item?.call_delta, + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.put_delta, + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.net_delta, + false, + true, + )} + + {#if item?.put_call_ratio <= 1} + {item?.put_call_ratio?.toFixed(2)} + {:else} + {item?.put_call_ratio?.toFixed(2)} + {/if} +
+
+ + +
+ {:else} +
+

+ Hottest Contracts +

+
+ +
+
+ {/if} +
+
+
+ + diff --git a/src/routes/etf/[tickerID]/options/dex/expiry/+page.server.ts b/src/routes/etf/[tickerID]/options/dex/expiry/+page.server.ts new file mode 100644 index 00000000..9e7bd003 --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/expiry/+page.server.ts @@ -0,0 +1,35 @@ + + +export const load = async ({ locals, params }) => { + const { apiKey, apiURL, user } = locals; + + const getData = async () => { + const postData = { + params: params.tickerID, + category: "expiry" + }; + + const response = await fetch(apiURL + "/options-gex-dex", { + 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/etf/[tickerID]/options/dex/expiry/+page.svelte b/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte new file mode 100644 index 00000000..d468b92d --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte @@ -0,0 +1,427 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$etfTicker}) Delta Exposure by Expiry · Stocknear + + + + + + + + + + + + + + + + +
+
+
+ {#if rawData?.length > 0} +
+

+ Delta Exposure By Expiry +

+ +
+ {#if options !== null} +
+ +
+ {:else} +
+
+ +
+
+ {/if} +
+
+ + + + + + {#each displayList as item, index} + + + + + + + + + + {/each} + +
+ {formatDate(item?.expiry)} + + {@html abbreviateNumberWithColor( + item?.call_delta?.toFixed(2), + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.put_delta?.toFixed(2), + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.net_delta?.toFixed(2), + false, + true, + )} + + {#if item?.put_call_ratio <= 1 && item?.put_call_ratio !== null} + {item?.put_call_ratio?.toFixed(2)} + {:else if item?.put_call_ratio > 1 && item?.put_call_ratio !== null} + {item?.put_call_ratio?.toFixed(2)} + {:else} + n/a + {/if} +
+
+ + +
+ {:else} +
+

+ Hottest Contracts +

+
+ +
+
+ {/if} +
+
+
+ + diff --git a/src/routes/etf/[tickerID]/options/dex/strike/+page.server.ts b/src/routes/etf/[tickerID]/options/dex/strike/+page.server.ts new file mode 100644 index 00000000..f33b0e12 --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/strike/+page.server.ts @@ -0,0 +1,35 @@ + + +export const load = async ({ locals, params }) => { + const { apiKey, apiURL, user } = locals; + + const getData = async () => { + const postData = { + params: params.tickerID, + category: "strike" + }; + + const response = await fetch(apiURL + "/options-gex-dex", { + 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/etf/[tickerID]/options/dex/strike/+page.svelte b/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte new file mode 100644 index 00000000..a47f6d1d --- /dev/null +++ b/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte @@ -0,0 +1,415 @@ + + + + + + + {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} + {$displayCompanyName} ({$etfTicker}) Delta Exposure by Strike Price · + Stocknear + + + + + + + + + + + + + + + + +
+
+
+ {#if rawData?.length > 0} +
+

+ Gamma Exposure By Strike +

+ +
+ {#if options !== null} +
+ +
+ {:else} +
+
+ +
+
+ {/if} +
+
+ + + + + + {#each displayList as item, index} + + + + + + + + + + {/each} + +
+ {item?.strike?.toFixed(2)} + + {@html abbreviateNumberWithColor( + item?.call_delta?.toFixed(2), + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.put_delta?.toFixed(2), + false, + true, + )} + + {@html abbreviateNumberWithColor( + item?.net_delta?.toFixed(2), + false, + true, + )} + + {#if item?.put_call_ratio <= 1 && item?.put_call_ratio !== null} + {item?.put_call_ratio?.toFixed(2)} + {:else if item?.put_call_ratio > 1 && item?.put_call_ratio !== null} + {item?.put_call_ratio?.toFixed(2)} + {:else} + n/a + {/if} +
+
+ + +
+ {:else} +
+
+ +
+
+ {/if} +
+
+
+ + diff --git a/src/routes/etf/[tickerID]/options/gex/+layout.svelte b/src/routes/etf/[tickerID]/options/gex/+layout.svelte index ca64a74b..9dbd9bfe 100644 --- a/src/routes/etf/[tickerID]/options/gex/+layout.svelte +++ b/src/routes/etf/[tickerID]/options/gex/+layout.svelte @@ -15,10 +15,10 @@ if (state !== "overview" && subSectionMap[state]) { displaySubSection = state; - //goto(`/stocks/${$etfTicker}${subSectionMap[state]}`); + //goto(`/etf/${$etfTicker}${subSectionMap[state]}`); } else { displaySubSection = state; - //goto(`/stocks/${$etfTicker}/statistics`); + //goto(`/etf/${$etfTicker}/statistics`); } } diff --git a/src/routes/etf/[tickerID]/options/gex/+page.svelte b/src/routes/etf/[tickerID]/options/gex/+page.svelte index d854d4cb..a643568d 100644 --- a/src/routes/etf/[tickerID]/options/gex/+page.svelte +++ b/src/routes/etf/[tickerID]/options/gex/+page.svelte @@ -5,7 +5,7 @@ monthNames, } from "$lib/utils"; import { - stockTicker, + etfTicker, screenWidth, numberOfUnreadNotification, displayCompanyName, @@ -337,7 +337,7 @@ {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Gamma Exposure · Stocknear + {$displayCompanyName} ({$etfTicker}) Gamma Exposure · Stocknear {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$etfTicker}) Gamma Exposure by Strike Price · - Stocknear + {$displayCompanyName} ({$etfTicker}) Gamma Exposure by Expiry · Stocknear @@ -279,11 +279,11 @@ diff --git a/src/routes/etf/[tickerID]/options/gex/strike/+page.svelte b/src/routes/etf/[tickerID]/options/gex/strike/+page.svelte index 26831378..cddcca67 100644 --- a/src/routes/etf/[tickerID]/options/gex/strike/+page.svelte +++ b/src/routes/etf/[tickerID]/options/gex/strike/+page.svelte @@ -249,7 +249,7 @@ @@ -259,7 +259,7 @@ /> @@ -272,7 +272,7 @@ /> diff --git a/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte b/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte index c75885cf..0f7a4293 100644 --- a/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte +++ b/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte @@ -132,8 +132,8 @@ // Convert the expiration date to a Date object const expirationDate = new Date(dateExpiration); - return data?.map((item) => { - const itemDate = new Date(item?.date); // Convert item.date to a Date object + return data.map((item) => { + const itemDate = new Date(item.date); // Convert item.date to a Date object const timeDifference = expirationDate - itemDate; // Difference in milliseconds const dte = Math.ceil(timeDifference / (1000 * 60 * 60 * 24)); // Convert ms to days @@ -427,7 +427,6 @@ result += `${bidColor}Bid x ${askColor}Ask: ${bidValue} x ${askValue}
`; } - // Add DTE at the end if the data point exists if (rawDataPoint?.dte !== undefined) { result += `Days to Expiration : ${rawDataPoint.dte}
`; } diff --git a/src/routes/heatmaps/+page.server.ts b/src/routes/heatmaps/+page.server.ts deleted file mode 100644 index 9562bd2e..00000000 --- a/src/routes/heatmaps/+page.server.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { getCache, setCache } from "$lib/store"; - -export const load = async ({ locals }) => { - const { apiURL, apiKey } = locals; - - const getSP500HeatMap = async () => { - const postData = { index: "sp500" }; - - // make the POST request to the endpoint - const response = await fetch(apiURL + "/heatmaps", { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-API-KEY": apiKey, - }, - body: JSON.stringify(postData), - }); - - const output = await response.json(); - - return output; - }; - - const getDowJonesHeatMap = async () => { - const postData = { index: "dowjones" }; - // make the POST request to the endpoint - const response = await fetch(apiURL + "/heatmaps", { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-API-KEY": apiKey, - }, - body: JSON.stringify(postData), - }); - - const output = await response.json(); - - return output; - }; - - const getNasdaqHeatMap = async () => { - const postData = { index: "nasdaq" }; - // make the POST request to the endpoint - const response = await fetch(apiURL + "/heatmaps", { - 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 { - getSP500HeatMap: await getSP500HeatMap(), - getDowJonesHeatMap: await getDowJonesHeatMap(), - getNasdaqHeatMap: await getNasdaqHeatMap(), - }; -}; diff --git a/src/routes/heatmaps/+page.svelte b/src/routes/heatmaps/+page.svelte deleted file mode 100644 index 63fc9e8e..00000000 --- a/src/routes/heatmaps/+page.svelte +++ /dev/null @@ -1,86 +0,0 @@ - - -
diff --git a/src/routes/stocks/[tickerID]/options/dex/+page.svelte b/src/routes/stocks/[tickerID]/options/dex/+page.svelte index c7ad0d07..ef2a07c0 100644 --- a/src/routes/stocks/[tickerID]/options/dex/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/dex/+page.svelte @@ -337,7 +337,7 @@ {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Gamma Exposure · Stocknear + {$displayCompanyName} ({$stockTicker}) Delta Exposure · Stocknear {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Gamma Exposure by Strike Price · - Stocknear + {$displayCompanyName} ({$stockTicker}) Delta Exposure by Expiry · Stocknear @@ -280,11 +279,11 @@ @@ -301,7 +300,7 @@

- Gamma Exposure By Expiry + Delta Exposure By Expiry

diff --git a/src/routes/stocks/[tickerID]/options/dex/strike/+page.svelte b/src/routes/stocks/[tickerID]/options/dex/strike/+page.svelte index 43c70a86..b3165903 100644 --- a/src/routes/stocks/[tickerID]/options/dex/strike/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/dex/strike/+page.svelte @@ -249,7 +249,7 @@ @@ -259,7 +259,7 @@ /> @@ -272,7 +272,7 @@ /> diff --git a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte index 98fc498d..0c1004f6 100644 --- a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte @@ -256,22 +256,21 @@ {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Gamma Exposure by Strike Price · - Stocknear + {$displayCompanyName} ({$stockTicker}) Gamma Exposure by Expiry · Stocknear @@ -280,11 +279,11 @@ diff --git a/src/routes/stocks/[tickerID]/options/gex/strike/+page.svelte b/src/routes/stocks/[tickerID]/options/gex/strike/+page.svelte index 23338ee3..719de6a5 100644 --- a/src/routes/stocks/[tickerID]/options/gex/strike/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/gex/strike/+page.svelte @@ -249,7 +249,7 @@ @@ -259,7 +259,7 @@ /> @@ -272,7 +272,7 @@ />