From a1ab9c38c86ce8817f6086bd18998ddffdef4e0c Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 7 Feb 2025 21:56:35 +0100 Subject: [PATCH] add gex/dex pages back --- .../components/Options/GreekByExpiry.svelte | 30 ++++++------ .../components/Options/GreekByStrike.svelte | 30 ++++++------ .../etf/[tickerID]/options/+layout.svelte | 3 +- .../etf/[tickerID]/options/dex/+layout.svelte | 12 ++--- .../[tickerID]/options/dex/+page.server.ts | 3 +- .../options/dex/expiry/+page.server.ts | 3 +- .../options/dex/strike/+page.server.ts | 3 +- .../etf/[tickerID]/options/gex/+layout.svelte | 13 +++-- .../[tickerID]/options/gex/+page.server.ts | 3 +- .../options/gex/expiry/+page.server.ts | 3 +- .../options/gex/strike/+page.server.ts | 3 +- .../[tickerID]/options/dex/+page.server.ts | 3 +- .../options/dex/expiry/+page.server.ts | 3 +- .../options/dex/expiry/+page.svelte | 47 +++---------------- .../options/dex/strike/+page.server.ts | 3 +- .../[tickerID]/options/gex/+page.server.ts | 3 +- .../options/gex/expiry/+page.server.ts | 6 +-- .../options/gex/expiry/+page.svelte | 47 +++---------------- .../options/gex/strike/+page.server.ts | 3 +- 19 files changed, 79 insertions(+), 142 deletions(-) diff --git a/src/lib/components/Options/GreekByExpiry.svelte b/src/lib/components/Options/GreekByExpiry.svelte index 37c9ed09..9c7a54eb 100644 --- a/src/lib/components/Options/GreekByExpiry.svelte +++ b/src/lib/components/Options/GreekByExpiry.svelte @@ -47,10 +47,10 @@ } else { result.push({ ...item, - net_delta: (item?.call_delta || 0) + (item?.put_delta || 0), + net_dex: (item?.call_dex || 0) + (item?.put_dex || 0), put_call_ratio: - item?.call_delta > 0 - ? Math.abs((item?.put_delta || 0) / item?.call_delta) + item?.call_dex > 0 + ? Math.abs((item?.put_dex || 0) / item?.call_dex) : null, }); } @@ -80,9 +80,9 @@ const processedData = rawData ?.map((d) => ({ expiry: formatDate(d?.expiry), - callValue: isGamma ? d?.call_gex : d?.call_delta, - putValue: isGamma ? d?.put_gex : d?.put_delta, - netValue: isGamma ? d?.net_gex : d?.net_delta, + callValue: isGamma ? d?.call_gex : d?.call_dex, + putValue: isGamma ? d?.put_gex : d?.put_dex, + netValue: isGamma ? d?.net_gex : d?.net_dex, })) .sort((a, b) => a.strike - b.strike); @@ -189,17 +189,17 @@ $: columns = [ { key: "expiry", label: "Expiry Date", align: "left" }, { - key: isGamma ? "call_gex" : "call_delta", + key: isGamma ? "call_gex" : "call_dex", label: isGamma ? "Call GEX" : "Call Delta", align: "right", }, { - key: isGamma ? "put_gex" : "put_delta", + key: isGamma ? "put_gex" : "put_dex", label: isGamma ? "Put GEX" : "Put Delta", align: "right", }, { - key: isGamma ? "net_gex" : "net_delta", + key: isGamma ? "net_gex" : "net_dex", label: isGamma ? "Net GEX" : "Net Delta", align: "right", }, @@ -212,9 +212,9 @@ $: sortOrders = { expiry: { order: "none", type: "date" }, - [isGamma ? "call_gex" : "call_delta"]: { order: "none", type: "number" }, - [isGamma ? "put_gex" : "put_delta"]: { order: "none", type: "number" }, - [isGamma ? "net_gex" : "net_delta"]: { order: "none", type: "number" }, + [isGamma ? "call_gex" : "call_dex"]: { order: "none", type: "number" }, + [isGamma ? "put_gex" : "put_dex"]: { order: "none", type: "number" }, + [isGamma ? "net_gex" : "net_dex"]: { order: "none", type: "number" }, put_call_ratio: { order: "none", type: "number" }, }; @@ -333,7 +333,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.call_gex : item?.call_delta)?.toFixed(2), + (isGamma ? item?.call_gex : item?.call_dex)?.toFixed(2), false, true, )} @@ -342,7 +342,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.put_gex : item?.put_delta)?.toFixed(2), + (isGamma ? item?.put_gex : item?.put_dex)?.toFixed(2), false, true, )} @@ -352,7 +352,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.net_gex : item?.net_delta)?.toFixed(2), + (isGamma ? item?.net_gex : item?.net_dex)?.toFixed(2), false, true, )} diff --git a/src/lib/components/Options/GreekByStrike.svelte b/src/lib/components/Options/GreekByStrike.svelte index 5c483986..d34d059a 100644 --- a/src/lib/components/Options/GreekByStrike.svelte +++ b/src/lib/components/Options/GreekByStrike.svelte @@ -44,10 +44,10 @@ } else { return { ...item, - net_delta: (item?.call_delta || 0) + (item?.put_delta || 0), + net_dex: (item?.call_dex || 0) + (item?.put_dex || 0), put_call_ratio: - item?.call_delta > 0 - ? Math.abs((item?.put_delta || 0) / item?.call_delta) + item?.call_dex > 0 + ? Math.abs((item?.put_dex || 0) / item?.call_dex) : null, }; } @@ -61,9 +61,9 @@ const processedData = rawData ?.map((d) => ({ strike: d?.strike, - callValue: isGamma ? d?.call_gex : d?.call_delta, - putValue: isGamma ? d?.put_gex : d?.put_delta, - netValue: isGamma ? d?.net_gex : d?.net_delta, + callValue: isGamma ? d?.call_gex : d?.call_dex, + putValue: isGamma ? d?.put_gex : d?.put_dex, + netValue: isGamma ? d?.net_gex : d?.net_dex, })) ?.sort((a, b) => a?.strike - b?.strike); @@ -168,17 +168,17 @@ $: columns = [ { key: "strike", label: "Strike Price", align: "left" }, { - key: isGamma ? "call_gex" : "call_delta", + key: isGamma ? "call_gex" : "call_dex", label: `Call ${isGamma ? "GEX" : "Delta"}`, align: "right", }, { - key: isGamma ? "put_gex" : "put_delta", + key: isGamma ? "put_gex" : "put_dex", label: `Put ${isGamma ? "GEX" : "Delta"}`, align: "right", }, { - key: isGamma ? "net_gex" : "net_delta", + key: isGamma ? "net_gex" : "net_dex", label: `Net ${isGamma ? "GEX" : "Delta"}`, align: "right", }, @@ -191,9 +191,9 @@ $: sortOrders = { strike: { order: "none", type: "number" }, - [isGamma ? "call_gex" : "call_delta"]: { order: "none", type: "number" }, - [isGamma ? "put_gex" : "put_delta"]: { order: "none", type: "number" }, - [isGamma ? "net_gex" : "net_delta"]: { order: "none", type: "number" }, + [isGamma ? "call_gex" : "call_dex"]: { order: "none", type: "number" }, + [isGamma ? "put_gex" : "put_dex"]: { order: "none", type: "number" }, + [isGamma ? "net_gex" : "net_dex"]: { order: "none", type: "number" }, put_call_ratio: { order: "none", type: "number" }, }; @@ -312,7 +312,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.call_gex : item?.call_delta)?.toFixed(2), + (isGamma ? item?.call_gex : item?.call_dex)?.toFixed(2), false, true, )} @@ -321,7 +321,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.put_gex : item?.put_delta)?.toFixed(2), + (isGamma ? item?.put_gex : item?.put_dex)?.toFixed(2), false, true, )} @@ -331,7 +331,7 @@ class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap" > {@html abbreviateNumberWithColor( - (isGamma ? item?.net_gex : item?.net_delta)?.toFixed(2), + (isGamma ? item?.net_gex : item?.net_dex)?.toFixed(2), false, true, )} diff --git a/src/routes/etf/[tickerID]/options/+layout.svelte b/src/routes/etf/[tickerID]/options/+layout.svelte index b6aa18a6..621d407a 100644 --- a/src/routes/etf/[tickerID]/options/+layout.svelte +++ b/src/routes/etf/[tickerID]/options/+layout.svelte @@ -111,7 +111,7 @@ > OI -
diff --git a/src/routes/etf/[tickerID]/options/dex/+layout.svelte b/src/routes/etf/[tickerID]/options/dex/+layout.svelte index 3822b3cc..e7c733c0 100644 --- a/src/routes/etf/[tickerID]/options/dex/+layout.svelte +++ b/src/routes/etf/[tickerID]/options/dex/+layout.svelte @@ -1,5 +1,5 @@ - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Delta Exposure by Expiry · Stocknear - - - - - - - - - - - - - - - +
{ const getData = async () => { const postData = { params: params.tickerID, - category: "strike" + category: "strike", + type: "dex", }; const response = await fetch(apiURL + "/options-gex-dex", { diff --git a/src/routes/stocks/[tickerID]/options/gex/+page.server.ts b/src/routes/stocks/[tickerID]/options/gex/+page.server.ts index 551787e8..7c36b588 100644 --- a/src/routes/stocks/[tickerID]/options/gex/+page.server.ts +++ b/src/routes/stocks/[tickerID]/options/gex/+page.server.ts @@ -6,7 +6,8 @@ export const load = async ({ locals, params }) => { const getData = async () => { const postData = { params: params.tickerID, - category: "overview" + category: "overview", + type: "", }; const response = await fetch(apiURL + "/options-gex-dex", { diff --git a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.server.ts b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.server.ts index 9e7bd003..c9af0fa7 100644 --- a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.server.ts +++ b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.server.ts @@ -6,7 +6,8 @@ export const load = async ({ locals, params }) => { const getData = async () => { const postData = { params: params.tickerID, - category: "expiry" + category: "expiry", + type: "gex", }; const response = await fetch(apiURL + "/options-gex-dex", { @@ -23,9 +24,6 @@ export const load = async ({ locals, params }) => { }; - - - // Make sure to return a promise return { getData: await getData(), diff --git a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte index d3e2086d..0034c1b5 100644 --- a/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/gex/expiry/+page.svelte @@ -1,53 +1,18 @@ - - - - - {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$stockTicker}) Gamma Exposure by Expiry · Stocknear - - - - - - - - - - - - - - - +
{ const getData = async () => { const postData = { params: params.tickerID, - category: "strike" + category: "strike", + type: "gex", }; const response = await fetch(apiURL + "/options-gex-dex", {