diff --git a/src/routes/options-flow/+page.svelte b/src/routes/options-flow/+page.svelte index d184a85d..20ea642a 100644 --- a/src/routes/options-flow/+page.svelte +++ b/src/routes/options-flow/+page.svelte @@ -468,7 +468,7 @@ onDestroy(async() => { function calculateStats(data) { - const { callVolumeSum, putVolumeSum, bullishCount, bearishCount } = data?.reduce((acc, item) => { + const { callVolumeSum, putVolumeSum, bullishCount, bearishCount, neutralCount } = data?.reduce((acc, item) => { const volume = parseInt(item?.volume); if (item?.put_call === "Calls") { @@ -481,21 +481,25 @@ function calculateStats(data) { acc.bullishCount += 1; } else if (item?.sentiment === "Bearish") { acc.bearishCount += 1; + } else if (item?.sentiment === "Neutral") { + acc.neutralCount += 1; } return acc; - }, { callVolumeSum: 0, putVolumeSum: 0, bullishCount: 0, bearishCount: 0 }); + }, { callVolumeSum: 0, putVolumeSum: 0, bullishCount: 0, bearishCount: 0, neutralCount: 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 if (neutralCount > bearishCount && neutralCount > bullishCount) { flowSentiment = 'Neutral'; + } else { + flowSentiment = '-'; } + putCallRatio = callVolumeSum !== 0 ? (putVolumeSum / callVolumeSum) : 0; callPercentage = (callVolumeSum+putVolumeSum) !== 0 ? Math.floor((callVolumeSum)/(callVolumeSum+putVolumeSum)*100) : 0; @@ -852,7 +856,7 @@ const debouncedHandleInput = debounce(handleInput, 300);
Flow Sentiment - {flowSentiment} + {flowSentiment}
@@ -1029,9 +1033,9 @@ const debouncedHandleInput = debounce(handleInput, 300); -
- -
+
+ {#if displayedData?.length !== 0} +
-->
+ {:else} +
+ + Looks like your taste is one-of-a-kind! No matches found... yet! +
+ {/if}