From fbd2bd152f4cef9212be0b72e3806509736f795c Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Thu, 12 Sep 2024 19:25:38 +0200 Subject: [PATCH] add more rules --- src/routes/options-flow/+page.svelte | 17 ++++++------- .../options-flow/workers/filterWorker.ts | 24 +++++++++++++++---- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/routes/options-flow/+page.svelte b/src/routes/options-flow/+page.svelte index 13fa2035..5f419767 100644 --- a/src/routes/options-flow/+page.svelte +++ b/src/routes/options-flow/+page.svelte @@ -29,7 +29,8 @@ const allRules = { sentiment: { label: 'Sentiment', step: ["Bullish","Neutral", "Bearish"], defaultValue: 'any' }, execution_estimate: { label: 'Execution', step: ["At Ask","At Bid", "Below Ask", "Below Bid"], defaultValue: 'any' }, option_activity_type: { label: 'Option Type', step: ["Sweep","Trade"], defaultValue: 'any' }, - date_expiration: { label: 'Date Expiration', step: ["Today", "1 day","1 Week","2 Weeks","1 Month","3 Months","6 Months","1 Year","3 Years"], defaultValue: 'any' }, + date_expiration: { label: 'Date Expiration', step: ["Same Day", "1 day","1 Week","2 Weeks","1 Month","3 Months","6 Months","1 Year","3 Years"], defaultValue: 'any' }, + underlying_type: { label: 'Asset Type', step: ["Stock", "ETF"], defaultValue: 'any' }, }; @@ -115,6 +116,7 @@ function handleAddRule() { case "execution_estimate": case "option_activity_type": case "date_expiration": + case "underlying_type": newRule = { name: ruleName, value: Array.isArray(valueMappings[ruleName]) ? valueMappings[ruleName] : [valueMappings[ruleName]] }; // Ensure value is an array break; default: @@ -188,7 +190,7 @@ async function handleChangeValue(value) { } else { checkedItems.add(value); } - if (["put_call","sentiment","execution_estimate","option_activity_type","date_expiration"]?.includes(ruleName)) { + if (["put_call","sentiment","execution_estimate","option_activity_type","date_expiration","underlying_type"]?.includes(ruleName)) { // Ensure valueMappings[ruleName] is initialized as an array if (!Array.isArray(valueMappings[ruleName])) { valueMappings[ruleName] = []; // Initialize as an empty array if not already @@ -372,7 +374,6 @@ function handleViewData(optionData) { if(ruleOfList?.length !== 0 || filterQuery?.length !== 0) { shouldLoadWorker.set(true) - console.log('yes') } if (previousCallVolume !== displayCallVolume && !muted) { @@ -774,7 +775,7 @@ const debouncedHandleInput = debounce(handleInput, 300); - {#if !['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration"]?.includes(row?.rule)} + {#if !['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration","underlying_type"]?.includes(row?.rule)}
@@ -798,7 +799,7 @@ const debouncedHandleInput = debounce(handleInput, 300);
{/if} - {#if !['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration"]?.includes(row?.rule)} + {#if !['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration","underlying_type"]?.includes(row?.rule)} {#each row?.step as newValue} @@ -807,7 +808,7 @@ const debouncedHandleInput = debounce(handleInput, 300); {/each} - {:else if ['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration"]?.includes(row?.rule)} + {:else if ['put_call',"sentiment", "execution_estimate","option_activity_type","date_expiration","underlying_type"]?.includes(row?.rule)} {#each row?.step as item}
event.preventDefault()}> @@ -1062,7 +1063,7 @@ const debouncedHandleInput = debounce(handleInput, 300); {formatTime(displayedData[index]?.time)}
-
assetSelector(displayedData[index]?.ticker, displayedData[index]?.assetType)} style="justify-content: center;" class="td text-sm sm:hover:text-white sm:text-[1rem] text-blue-400 font-normal"> +
assetSelector(displayedData[index]?.ticker, displayedData[index]?.underlying_type)} style="justify-content: center;" class="td text-sm sm:hover:text-white sm:text-[1rem] text-blue-400 font-normal"> {displayedData[index]?.ticker}
@@ -1151,7 +1152,7 @@ const debouncedHandleInput = debounce(handleInput, 300); -