+
+
+
+ Unsual Options Activity
+
+
+
+
+
+ {#if optionsPlotData?.length !== 0}
+ Last 3 months of options activity involving {$displayCompanyName} by major institutional traders and hedge funds.
+ {:else}
+ There's no data available, indicating that major traders may not be actively betting on {$displayCompanyName}.
+ {/if}
+
+
+
+
+
+
+ {#if optionsPlotData?.length !== 0}
+
+
+
+
-
-
-
-
-
- Total Volume
-
-
-
-
{displayTotalVolume}
-
-
-
-
-
-
-
- Total OI
-
-
-
-
-
{displayTotalOpenInterest}
-
-
-
-
-
- P/C Ratio
-
-
-
-
- {totalPutCallRatio !== 'Infinity' ? totalPutCallRatio : '> 1'}
-
-
-
-
-
-
- OI P/C Ratio
-
-
+
+
+ Total Volume
+
+
- {putCallOpenInterestRatio !== 'Infinity' ? putCallOpenInterestRatio : '> 1'}
-
-
-
-
-
-
-
+
{displayTotalVolume}
+
-
-
-
- Choose a category
- Volume
- Open Interest
-
-
-
-
-
-
+
+
+
+
+
+ Total OI
+
+
-
-
-
- Latest Options Activity
-
-
-
-
- {#if optionList?.length !== 0}
-
-
-
-
-
-
-
- Flow Sentiment
- {flowSentiment}
-
-
+
{displayTotalOpenInterest}
+
+
+
+
+
+ P/C Ratio
+
+
+
+
+ {totalPutCallRatio !== 'Infinity' ? totalPutCallRatio : '> 1'}
+
+
+
+
+
+
+ OI P/C Ratio
+
+
-
-
+
{putCallOpenInterestRatio !== 'Infinity' ? putCallOpenInterestRatio : '> 1'}
+
+
+
+
+
+
+
+
+
+
+
+ Choose a category
+ Volume
+ Open Interest
+
+
+
+
+
+
+
+
+
+
+
+ Latest Options Activity
+
+
+
+
+ {#if optionList?.length !== 0}
+
+
+
+
+
+
+
+ Flow Sentiment
+ {flowSentiment}
+
+
+
+
+
+
+
+ Put/Call
+
+ {latestPutCallRatio?.toFixed(3)}
+
+
+
+
+
+
+
+
+
+ =1 ? 0 : 100-(latestPutCallRatio*100)?.toFixed(2)}>
+
+
+
+
+ {latestPutCallRatio?.toFixed(2)}
+
+
+
+
+
+
+
- Put/Call
+ Call Flow
- {latestPutCallRatio?.toFixed(3)}
-
-
-
-
-
-
-
-
-
- =1 ? 0 : 100-(latestPutCallRatio*100)?.toFixed(2)}>
-
-
-
-
- {latestPutCallRatio?.toFixed(2)}
-
-
-
-
-
-
-
-
-
- Call Flow
-
- {new Intl.NumberFormat("en", {
- minimumFractionDigits: 0,
- maximumFractionDigits: 0
- }).format(displayCallVolume)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {callPercentage}%
-
-
-
-
-
-
-
-
- Put Flow
-
- {new Intl.NumberFormat("en", {
- minimumFractionDigits: 0,
- maximumFractionDigits: 0
- }).format(displayPutVolume)}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {putPercentage}%
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Time
- Date
- Expiry
- Strike
- C/P
- Sent.
- Spot
- Price
- Prem.
- Type
- Vol.
- OI
-
-
-
- {#each (data?.user?.tier === 'Pro' ? optionList : optionList?.slice(0,3)) as item, index}
-
-
-
-
- {formatTime(item?.time)}
-
-
-
- {formatDate(item?.date)}
-
-
-
- {item?.dte < 0 ? 'expired' : item?.dte +'d'}
-
-
-
- {item?.strike_price}
-
-
-
- {item?.put_call}
-
-
-
- {item?.sentiment}
-
-
-
- {item?.underlying_price}
-
-
-
- {item?.price}
-
-
-
- {abbreviateNumber(item?.cost_basis)}
-
-
-
- {item?.type}
-
-
-
-
-
- {new Intl.NumberFormat("en", {
- minimumFractionDigits: 0,
- maximumFractionDigits: 0
- }).format(item?.volume)}
-
-
-
{new Intl.NumberFormat("en", {
minimumFractionDigits: 0,
maximumFractionDigits: 0
- }).format(item?.open_interest)}
-
-
-
-
-
-
-
-
- {/each}
-
-
-
-
-
-
-
-
- {:else}
-
-
-
- No Options activity found
+ }).format(displayCallVolume)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {callPercentage}%
+
+
+
-
- {/if}
-
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/routes/stocks/[tickerID]/options/+page.svelte b/src/routes/stocks/[tickerID]/options/+page.svelte
index 0d78e0e8..0ec7f10d 100644
--- a/src/routes/stocks/[tickerID]/options/+page.svelte
+++ b/src/routes/stocks/[tickerID]/options/+page.svelte
@@ -22,6 +22,7 @@ let putPercentage;
let displayCallVolume;
let displayPutVolume;
let latestPutCallRatio;
+let displayOTMRatio;
const totalPutCallRatio = data?.getOptionsPlotData?.putCallRatio;
@@ -89,10 +90,6 @@ function changeStatement(event)
displayData = event.target.value;
}
-let tableVolume = 0;
-let tableOpenInterest = 0;
-let tableAvgDTE = 0;
-
function plotData(callData, putData) {
@@ -168,40 +165,53 @@ function plotData(callData, putData) {
}
function calculateStats() {
- const { callVolumeSum, putVolumeSum, bullishCount, bearishCount } = rawData?.reduce((acc, item) => {
- const volume = parseInt(item?.volume);
-
- if (item?.put_call === "Calls") {
- acc.callVolumeSum += volume;
- } else if (item?.put_call === "Puts") {
- acc.putVolumeSum += volume;
- }
+ const currentPrice = parseFloat(data?.getStockQuote?.price);
+
+ const { callVolumeSum, putVolumeSum, bullishCount, bearishCount, otmVolume, itmVolume } = rawData?.reduce((acc, item) => {
+ const volume = parseInt(item?.volume);
+ const strikePrice = parseFloat(item?.strike_price);
+
+ if (item?.put_call === "Calls") {
+ acc.callVolumeSum += volume;
+ if (strikePrice > currentPrice) {
+ acc.otmVolume += volume;
+ } else {
+ acc.itmVolume += volume;
+ }
+ } else if (item?.put_call === "Puts") {
+ acc.putVolumeSum += volume;
+ if (strikePrice < currentPrice) {
+ acc.itmVolume += volume;
+ } else {
+ acc.otmVolume += volume;
+ }
+ }
+
+ if (item?.sentiment === "Bullish") {
+ acc.bullishCount += 1;
+ } else if (item?.sentiment === "Bearish") {
+ acc.bearishCount += 1;
+ }
- if (item?.sentiment === "Bullish") {
- acc.bullishCount += 1;
- } else if (item?.sentiment === "Bearish") {
- acc.bearishCount += 1;
- }
-
return acc;
- }, { callVolumeSum: 0, putVolumeSum: 0, bullishCount: 0, bearishCount: 0 });
+ }, { callVolumeSum: 0, putVolumeSum: 0, bullishCount: 0, bearishCount: 0, otmVolume: 0, itmVolume: 0 });
- if(bullishCount > bearishCount) {
- flowSentiment = 'Bullish'
- }
- else if (bullishCount < bearishCount) {
- flowSentiment = 'Bearish'
- } else {
+ if (bullishCount > bearishCount) {
+ flowSentiment = 'Bullish';
+ } else if (bullishCount < bearishCount) {
+ flowSentiment = 'Bearish';
+ } else {
flowSentiment = 'Neutral';
- }
- latestPutCallRatio = (putVolumeSum/callVolumeSum);
-
- callPercentage = Math.floor((callVolumeSum)/(callVolumeSum+putVolumeSum)*100);
- putPercentage = (100-callPercentage);
+ }
+ latestPutCallRatio = (putVolumeSum / callVolumeSum);
+ callPercentage = Math.floor((callVolumeSum) / (callVolumeSum + putVolumeSum) * 100);
+ putPercentage = (100 - callPercentage);
displayCallVolume = callVolumeSum;
displayPutVolume = putVolumeSum;
-
+
+ // Calculate OTM/ITM ratio
+ displayOTMRatio = otmVolume / (itmVolume+otmVolume) ?? 0;
}
async function handleScroll() {
@@ -217,9 +227,8 @@ async function handleScroll() {
onMount(async () => {
-
calculateStats();
-
+
if(data?.user?.tier === 'Pro') {
window.addEventListener('scroll', handleScroll);
return () => {
@@ -397,7 +406,7 @@ $: {
- Flow Sentiment
+ Flow Sentiment
{flowSentiment}
@@ -406,7 +415,7 @@ $: {
-
Put/Call
+
Put/Call
{latestPutCallRatio?.toFixed(3)}
@@ -433,7 +442,7 @@ $: {
-
Call Flow
+
Call Flow
{new Intl.NumberFormat("en", {
minimumFractionDigits: 0,
@@ -462,7 +471,7 @@ $: {
- Put Flow
+ Put Flow
{new Intl.NumberFormat("en", {
minimumFractionDigits: 0,
@@ -489,6 +498,34 @@ $: {
+
+
+
+
+ Ratio %
+
+ OTM / ITM
+
+
+
+
+
+
+
+
+
+ =1 ? 0 : 100-(displayOTMRatio*100)?.toFixed(2)}>
+
+
+
+
+ {(displayOTMRatio*100)?.toFixed(0)}%
+
+
+
+
+
+