From 0daee2279d344e4079455a89749eab5440de11c3 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 3 Sep 2024 12:32:03 +0200 Subject: [PATCH] add fcf in screener --- .../stock-screener/[strategyId]/+page.svelte | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/routes/stock-screener/[strategyId]/+page.svelte b/src/routes/stock-screener/[strategyId]/+page.svelte index c2e74ce0..cfbaaa34 100644 --- a/src/routes/stock-screener/[strategyId]/+page.svelte +++ b/src/routes/stock-screener/[strategyId]/+page.svelte @@ -125,6 +125,7 @@ const getStockScreenerData = async (rules) => { shortFloatPercent: (ruleOfList?.find(item => item.name === "shortFloatPercent") || { condition: 'over' }).condition, shortOutStandingPercent: (ruleOfList?.find(item => item.name === "shortOutStandingPercent") || { condition: 'over' }).condition, failToDeliver: (ruleOfList?.find(item => item.name === "failToDeliver") || { condition: 'over' }).condition, + freeCashFlow: (ruleOfList?.find(item => item.name === "freeCashFlow") || { condition: 'over' }).condition, }; @@ -198,6 +199,7 @@ const getStockScreenerData = async (rules) => { { rule: 'shortFloatPercent', label: 'Short % Float', step: [50,30,20,10,5,1,0], unit: '%',category: 'fund' }, { rule: 'shortOutStandingPercent', label: 'Short % Shares', step: [50,30,20,10,5,1,0], unit: '%',category: 'fund' }, { rule: 'failToDeliver', label: 'Fail to Deliver', step: [500,200,100,50,20,10,5], unit: 'K',category: 'fund' }, + { rule: 'freeCashFlow', label: 'Free Cash Flow', step: [500,200,100,50,20,10,1,0], unit: 'M',category: 'fund' }, ]; @@ -290,7 +292,7 @@ const getStockScreenerData = async (rules) => { let valueShortFloatPercent = (ruleOfList?.find(item => item.name === "shortFloatPercent") || { value: 'any'}).value; let valueShortOutStandingPercent = (ruleOfList?.find(item => item.name === "shortOutStandingPercent") || { value: 'any'}).value; let valueFailToDeliver = (ruleOfList?.find(item => item.name === "failToDeliver") || { value: 'any'}).value; - + let valueFreeCashFlow = (ruleOfList?.find(item => item.name === "freeCashFlow") || { value: 'any'}).value; @@ -374,6 +376,7 @@ const valueMappings = { shortOutStandingPercent: valueShortOutStandingPercent, analystRating: valueAnalystRating, failToDeliver: valueFailToDeliver, + freeCashFlow: valueFreeCashFlow, }; @@ -445,6 +448,7 @@ const conditions = { shortFloatPercent: ruleCondition.shortFloatPercent, shortOutStandingPercent: ruleCondition.shortOutStandingPercent, failToDeliver: ruleCondition.failToDeliver, + freeCashFlow: ruleCondition.freeCashFlow, }; @@ -703,6 +707,7 @@ $: { shortFloatPercent: valueShortFloatPercent, shortOutStandingPercent: valueShortOutStandingPercent, failToDeliver: valueFailToDeliver, + freeCashFlow: valueFreeCashFlow, }; ruleToUpdate.value = valueMap[ruleToUpdate.name] ?? ruleToUpdate.value; @@ -1065,6 +1070,8 @@ function handleChangeValue(value) { valueShortOutStandingPercent = value; case 'failToDeliver': valueFailToDeliver = value; + case 'freeCashFlow': + valueFreeCashFlow = value; } } else { console.warn(`Unhandled rule: ${rule}`); @@ -1220,22 +1227,22 @@ async function popularStrategy(state: string) { - popularStrategy('dividendGrowth')} class="cursor-pointer"> + popularStrategy('dividendGrowth')} class="cursor-pointer hover:bg-[#27272A]"> Dividend Growth - popularStrategy('topGainers1Y')} class="cursor-pointer"> + popularStrategy('topGainers1Y')} class="cursor-pointer hover:bg-[#27272A]"> Top Gainers 1Y - popularStrategy('topShortedStocks')} class="cursor-pointer"> + popularStrategy('topShortedStocks')} class="cursor-pointer hover:bg-[#27272A]"> Top Shorted Stocks - popularStrategy('topAIStocks')} class="cursor-pointer"> + popularStrategy('topAIStocks')} class="cursor-pointer hover:bg-[#27272A]"> Top AI Stocks - popularStrategy('momentumTAStocks')} class="cursor-pointer"> + popularStrategy('momentumTAStocks')} class="cursor-pointer hover:bg-[#27272A]"> Momentum TA Stocks - popularStrategy('underValuedStocks')} class="cursor-pointer"> + popularStrategy('underValuedStocks')} class="cursor-pointer hover:bg-[#27272A]"> Undervalued Stocks @@ -1253,7 +1260,7 @@ async function popularStrategy(state: string) {
-
+
@@ -1355,7 +1362,7 @@ async function popularStrategy(state: string) { {#each row?.step as newValue} -