diff --git a/src/lib/components/Options/GreekByExpiry.svelte b/src/lib/components/Options/GreekByExpiry.svelte
index 226d868c..d4f1a445 100644
--- a/src/lib/components/Options/GreekByExpiry.svelte
+++ b/src/lib/components/Options/GreekByExpiry.svelte
@@ -25,19 +25,33 @@
]);
export let data;
- export let title;
+ export let title = "Gamma";
let rawData = data?.getData || [];
- rawData = rawData?.map((item) => ({
- ...item,
- net_gex: (item?.call_gex || 0) + (item?.put_gex || 0),
- put_call_ratio:
- item?.call_gex > 0
- ? Math.abs((item?.put_gex || 0) / item?.call_gex)
- : null,
- }));
+ const isGamma = title === "Gamma";
+ rawData = rawData?.map((item) => {
+ if (title === "Gamma") {
+ return {
+ ...item,
+ net_gex: (item?.call_gex || 0) + (item?.put_gex || 0),
+ put_call_ratio:
+ item?.call_gex > 0
+ ? Math.abs((item?.put_gex || 0) / item?.call_gex)
+ : null,
+ };
+ } else {
+ return {
+ ...item,
+ net_delta: (item?.call_delta || 0) + (item?.put_delta || 0),
+ put_call_ratio:
+ item?.call_delta > 0
+ ? Math.abs((item?.put_delta || 0) / item?.call_delta)
+ : null,
+ };
+ }
+ });
let displayList = rawData?.slice(0, 150);
let options = null;
@@ -53,20 +67,23 @@
}
function plotData() {
- // Process and sort data by strike in descending order
+ // Determine if the current data is Gamma-based or not
+ const isGamma = title === "Gamma";
+
+ // Process and sort data by strike or expiry
const processedData = rawData
?.map((d) => ({
expiry: formatDate(d?.expiry),
- callGamma: d?.call_gex,
- putGamma: d?.put_gex,
- netGamma: d?.net_gex,
+ callValue: isGamma ? d?.call_gex : d?.call_delta,
+ putValue: isGamma ? d?.put_gex : d?.put_delta,
+ netValue: isGamma ? d?.net_gex : d?.net_delta,
}))
.sort((a, b) => a.strike - b.strike);
const expiries = processedData.map((d) => d.expiry);
- const callGamma = processedData.map((d) => d.callGamma?.toFixed(2));
- const putGamma = processedData.map((d) => d.putGamma?.toFixed(2));
- const netGamma = processedData.map((d) => d.netGamma?.toFixed(2));
+ const callValue = processedData.map((d) => d.callValue?.toFixed(2));
+ const putValue = processedData.map((d) => d.putValue?.toFixed(2));
+ const netValue = processedData.map((d) => d.netValue?.toFixed(2));
const options = {
animation: false,
@@ -82,15 +99,15 @@
formatter: function (params) {
const expiry = params[0].axisValue;
const put = params[0].data;
- const call = params[1].data;
- const net = params[2].data;
+ const net = params[1].data;
+ const call = params[2].data;
return `
-
-
Expiry: ${expiry}
-
● Put Gamma: ${abbreviateNumberWithColor(put, false, true)}
-
● Call Gamma: ${abbreviateNumberWithColor(call, false, true)}
-
● Net Gamma: ${abbreviateNumberWithColor(net, false, true)}
+
+ Expiry: ${expiry}
+ ● Put ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(put, false, true)}
+ ● Net ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(net, false, true)}
+ ● Call ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(call, false, true)}
`;
},
},
@@ -102,7 +119,7 @@
},
xAxis: {
type: "value",
- name: "Gamma",
+ name: isGamma ? "Gamma" : "Delta",
nameTextStyle: { color: "#fff" },
splitLine: { show: false },
axisLabel: {
@@ -118,25 +135,25 @@
},
series: [
{
- name: "Put Gamma",
+ name: `Put ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: putGamma,
- stack: "gamma",
+ data: putValue,
+ stack: isGamma ? "gamma" : "delta",
itemStyle: { color: "#9B5DC4" },
barWidth: "40%",
},
{
- name: "Net Gamma",
+ name: `Net ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: netGamma,
- stack: "gamma",
+ data: netValue,
+ stack: isGamma ? "gamma" : "delta",
itemStyle: { color: "#FF2F1F" },
},
{
- name: "Call Gamma",
+ name: `Call ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: callGamma,
- stack: "gamma",
+ data: callValue,
+ stack: isGamma ? "gamma" : "delta",
itemStyle: { color: "#C4E916" },
},
],
@@ -165,17 +182,33 @@
$: columns = [
{ key: "expiry", label: "Expiry Date", align: "left" },
- { key: "call_gex", label: "Call GEX", align: "right" },
- { key: "put_gex", label: "Put GEX", align: "right" },
- { key: "net_gex", label: "Net GEX", align: "right" },
- { key: "put_call_ratio", label: "P/C GEX", align: "right" },
+ {
+ key: isGamma ? "call_gex" : "call_delta",
+ label: isGamma ? "Call GEX" : "Call Delta",
+ align: "right",
+ },
+ {
+ key: isGamma ? "put_gex" : "put_delta",
+ label: isGamma ? "Put GEX" : "Put Delta",
+ align: "right",
+ },
+ {
+ key: isGamma ? "net_gex" : "net_delta",
+ label: isGamma ? "Net GEX" : "Net Delta",
+ align: "right",
+ },
+ {
+ key: "put_call_ratio",
+ label: isGamma ? "P/C GEX" : "P/C Delta",
+ align: "right",
+ },
];
$: sortOrders = {
expiry: { order: "none", type: "date" },
- call_gex: { order: "none", type: "number" },
- put_gex: { order: "none", type: "number" },
- net_gex: { 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" },
put_call_ratio: { order: "none", type: "number" },
};
@@ -247,7 +280,7 @@
- Gamma Exposure By Expiry
+ {title} Exposure By Expiry
@@ -294,7 +327,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.call_gex?.toFixed(2),
+ (isGamma ? item?.call_gex : item?.call_delta)?.toFixed(2),
false,
true,
)}
@@ -303,7 +336,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.put_gex?.toFixed(2),
+ (isGamma ? item?.put_gex : item?.put_delta)?.toFixed(2),
false,
true,
)}
@@ -313,7 +346,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.net_gex?.toFixed(2),
+ (isGamma ? item?.net_gex : item?.net_delta)?.toFixed(2),
false,
true,
)}
diff --git a/src/lib/components/Options/GreekByStrike.svelte b/src/lib/components/Options/GreekByStrike.svelte
index 1e922b8d..9dbce72d 100644
--- a/src/lib/components/Options/GreekByStrike.svelte
+++ b/src/lib/components/Options/GreekByStrike.svelte
@@ -25,38 +25,52 @@
]);
export let data;
- export let title;
+ export let title = "Gamma";
+
+ $: isGamma = title === "Gamma";
let rawData = data?.getData || [];
- rawData = rawData?.map((item) => ({
- ...item,
- net_gex: (item?.call_gex || 0) + (item?.put_gex || 0),
- put_call_ratio:
- item?.call_gex > 0
- ? Math.abs((item?.put_gex || 0) / item?.call_gex)
- : null,
- }));
+ rawData = rawData?.map((item) => {
+ if (title === "Gamma") {
+ return {
+ ...item,
+ net_gex: (item?.call_gex || 0) + (item?.put_gex || 0),
+ put_call_ratio:
+ item?.call_gex > 0
+ ? Math.abs((item?.put_gex || 0) / item?.call_gex)
+ : null,
+ };
+ } else {
+ return {
+ ...item,
+ net_delta: (item?.call_delta || 0) + (item?.put_delta || 0),
+ put_call_ratio:
+ item?.call_delta > 0
+ ? Math.abs((item?.put_delta || 0) / item?.call_delta)
+ : null,
+ };
+ }
+ });
let displayList = rawData?.slice(0, 150);
let options = null;
function plotData() {
- // Process and sort data by strike in descending order
+ const isGamma = title === "Gamma"; // don't delete this $: isGamma is not rendered fast enough; stupid fkn javascript
const processedData = rawData
?.map((d) => ({
strike: d?.strike,
- callGamma: d?.call_gex,
- putGamma: d?.put_gex,
- netGamma: d?.net_gex,
+ callValue: isGamma ? d?.call_gex : d?.call_delta,
+ putValue: isGamma ? d?.put_gex : d?.put_delta,
+ netValue: isGamma ? d?.net_gex : d?.net_delta,
}))
- .sort((a, b) => a.strike - b.strike);
-
- const strikes = processedData.map((d) => d.strike);
- const callGamma = processedData.map((d) => d.callGamma?.toFixed(2));
- const putGamma = processedData.map((d) => d.putGamma?.toFixed(2));
- const netGamma = processedData.map((d) => d.netGamma?.toFixed(2));
+ ?.sort((a, b) => a?.strike - b?.strike);
+ const strikes = processedData?.map((d) => d.strike);
+ const callValues = processedData?.map((d) => d.callValue?.toFixed(2));
+ const putValues = processedData?.map((d) => d.putValue?.toFixed(2));
+ const netValues = processedData?.map((d) => d.netValue?.toFixed(2));
const options = {
animation: false,
tooltip: {
@@ -71,16 +85,16 @@
formatter: function (params) {
const strike = params[0].axisValue;
const put = params[0].data;
- const call = params[1].data;
- const net = params[2].data;
+ const net = params[1].data;
+ const call = params[2].data;
return `
Strike: ${strike}
- ● Put Gamma: ${abbreviateNumberWithColor(put, false, true)}
- ● Call Gamma: ${abbreviateNumberWithColor(call, false, true)}
- ● Net Gamma: ${abbreviateNumberWithColor(net, false, true)}
-
`;
+
● Put ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(put, false, true)}
+
● Net ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(net, false, true)}
+
● Call ${isGamma ? "Gamma" : "Delta"}: ${abbreviateNumberWithColor(call, false, true)}
+
`;
},
},
grid: {
@@ -91,11 +105,10 @@
},
xAxis: {
type: "value",
- name: "Gamma",
nameTextStyle: { color: "#fff" },
splitLine: { show: false },
axisLabel: {
- show: false, // Hide y-axis labels
+ show: false, // Hide x-axis labels
},
},
yAxis: {
@@ -107,24 +120,24 @@
},
series: [
{
- name: "Put Gamma",
+ name: `Put ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: putGamma,
- stack: "gamma",
+ data: putValues,
+ stack: "value",
itemStyle: { color: "#9B5DC4" },
},
{
- name: "Net Gamma",
+ name: `Net ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: netGamma,
- stack: "gamma",
+ data: netValues,
+ stack: "value",
itemStyle: { color: "#FF2F1F" },
},
{
- name: "Call Gamma",
+ name: `Call ${isGamma ? "Gamma" : "Delta"}`,
type: "bar",
- data: callGamma,
- stack: "gamma",
+ data: callValues,
+ stack: "value",
itemStyle: { color: "#C4E916" },
},
],
@@ -153,17 +166,33 @@
$: columns = [
{ key: "strike", label: "Strike Price", align: "left" },
- { key: "call_gex", label: "Call GEX", align: "right" },
- { key: "put_gex", label: "Put GEX", align: "right" },
- { key: "net_gex", label: "Net GEX", align: "right" },
- { key: "put_call_ratio", label: "P/C GEX", align: "right" },
+ {
+ key: isGamma ? "call_gex" : "call_delta",
+ label: `Call ${isGamma ? "GEX" : "Delta"}`,
+ align: "right",
+ },
+ {
+ key: isGamma ? "put_gex" : "put_delta",
+ label: `Put ${isGamma ? "GEX" : "Delta"}`,
+ align: "right",
+ },
+ {
+ key: isGamma ? "net_gex" : "net_delta",
+ label: `Net ${isGamma ? "GEX" : "Delta"}`,
+ align: "right",
+ },
+ {
+ key: "put_call_ratio",
+ label: `P/C`,
+ align: "right",
+ },
];
$: sortOrders = {
strike: { order: "none", type: "number" },
- call_gex: { order: "none", type: "number" },
- put_gex: { order: "none", type: "number" },
- net_gex: { 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" },
put_call_ratio: { order: "none", type: "number" },
};
@@ -282,7 +311,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.call_gex?.toFixed(2),
+ (isGamma ? item?.call_gex : item?.call_delta)?.toFixed(2),
false,
true,
)}
@@ -291,7 +320,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.put_gex?.toFixed(2),
+ (isGamma ? item?.put_gex : item?.put_delta)?.toFixed(2),
false,
true,
)}
@@ -301,7 +330,7 @@
class="text-white text-sm sm:text-[1rem] text-end whitespace-nowrap"
>
{@html abbreviateNumberWithColor(
- item?.net_gex?.toFixed(2),
+ (isGamma ? item?.net_gex : item?.net_delta)?.toFixed(2),
false,
true,
)}
diff --git a/src/routes/etf/[tickerID]/news/+page.server.ts b/src/routes/etf/[tickerID]/news/+page.server.ts
deleted file mode 100644
index 4eb3b120..00000000
--- a/src/routes/etf/[tickerID]/news/+page.server.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-export const load = async ({ locals, params }) => {
- const getStockNews = async () => {
- const { apiKey, apiURL } = locals;
- const postData = {
- ticker: params.tickerID,
- };
-
- // make the POST request to the endpoint
- const response = await fetch(apiURL + "/stock-news", {
- 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 {
- getStockNews: await getStockNews(),
- };
-};
diff --git a/src/routes/etf/[tickerID]/news/+page.svelte b/src/routes/etf/[tickerID]/news/+page.svelte
deleted file mode 100644
index 5f2b2b6a..00000000
--- a/src/routes/etf/[tickerID]/news/+page.svelte
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
-
-
- {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""}
- {$displayCompanyName} ({$etfTicker}) latest Stock Market News and Breaking
- Stories · Stocknear
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
News
-
-
- {#if newsList.length !== 0}
-
- {#each newsList as item}
-
- {#if (videoId = checkIfYoutubeVideo(item.url))}
-
- {:else}
-
-
-

-
-
- {/if}
-
-
-
-
- {/each}
-
- {#if newsList?.length !== rawNews?.length}
-
- {/if}
- {:else}
-
-
- No news article published yet!
-
- {/if}
-
-
-
-
diff --git a/src/routes/etf/[tickerID]/options/dex/+page.svelte b/src/routes/etf/[tickerID]/options/dex/+page.svelte
index 3127c762..cfec412f 100644
--- a/src/routes/etf/[tickerID]/options/dex/+page.svelte
+++ b/src/routes/etf/[tickerID]/options/dex/+page.svelte
@@ -1,335 +1,13 @@
@@ -376,127 +54,10 @@
- {#if rawData?.length > 0}
-
-
- Daily Delta Exposure
-
-
-
- {#if options !== null}
-
-
- {#each ["3M", "6M", "1Y"] as item}
-
- {/each}
-
-
-
-
- {:else}
-
- {/if}
-
-
-
-
-
-
-
- {#each data?.user?.tier === "Pro" ? displayList : displayList?.slice(0, 3) as item, index}
-
- |
- {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}
- |
-
- {/each}
-
-
-
-
-
-
+ {#if data?.getData?.length > 0}
+
{:else}
-
- Hottest Contracts
-
@@ -505,21 +66,3 @@
-
-
diff --git a/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte b/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte
index 87742657..efb28279 100644
--- a/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte
+++ b/src/routes/etf/[tickerID]/options/dex/expiry/+page.svelte
@@ -1,250 +1,15 @@
@@ -292,113 +57,9 @@
class="w-full relative flex justify-center items-center overflow-hidden"
>
{#if rawData?.length > 0}
-
-
- Delta Exposure By Expiry
-
-
-
- {#if options !== null}
-
-
-
- {:else}
-
- {/if}
-
-
-
-
-
-
-
- {#each data?.user?.tier === "Pro" ? displayList : displayList?.slice(0, 3) as item, index}
-
- |
- {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}
- |
-
- {/each}
-
-
-
-
-
-
+
{:else}
-
- Hottest Contracts
-
@@ -407,21 +68,3 @@
-
-
diff --git a/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte b/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte
index 4ab6dbbb..d90ab50d 100644
--- a/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte
+++ b/src/routes/etf/[tickerID]/options/dex/strike/+page.svelte
@@ -1,242 +1,15 @@