diff --git a/src/routes/stock-screener/[strategyId]/+page.svelte b/src/routes/stock-screener/[strategyId]/+page.svelte index 540d395a..4b506354 100644 --- a/src/routes/stock-screener/[strategyId]/+page.svelte +++ b/src/routes/stock-screener/[strategyId]/+page.svelte @@ -17,15 +17,15 @@ const title = data?.getStrategy?.title; - let stockScreenerData = data?.getStockScreenerData?.filter(item => { - const ratingRecommendationExists = item?.ratingRecommendation !== null; - const trendAnalysisAccuracyExists = item?.trendAnalysis?.accuracy !== null; - const fundamentalAnalysisAccuracyExists = item?.fundamentalAnalysis?.accuracy !== null; - - - // Return true only if both conditions are satisfied - return ratingRecommendationExists && trendAnalysisAccuracyExists && fundamentalAnalysisAccuracyExists; -}); + let stockScreenerData = data?.getStockScreenerData?.filter(item => + item?.ratingRecommendation !== null && + item?.trendAnalysis?.accuracy !== null && + item?.fundamentalAnalysis?.accuracy !== null && + item?.dividendYield !== null && + item?.annualDividend !== null && + item?.dividendGrowth !== null && + item?.payoutRatio !== null +); const getStockScreenerData = async (rules) => { @@ -78,6 +78,10 @@ const getStockScreenerData = async (rules) => { change6M: (ruleOfList?.find(item => item.name === "change6M") || { condition: 'above' }).condition, change1Y: (ruleOfList?.find(item => item.name === "change1Y") || { condition: 'above' }).condition, change3Y: (ruleOfList?.find(item => item.name === "change3Y") || { condition: 'above' }).condition, + payoutRatio: (ruleOfList?.find(item => item.name === "payoutRatio") || { condition: 'above' }).condition, + annualDividend: (ruleOfList?.find(item => item.name === "annualDividend") || { condition: 'above' }).condition, + dividendYield: (ruleOfList?.find(item => item.name === "dividendYield") || { condition: 'above' }).condition, + dividendGrowth: (ruleOfList?.find(item => item.name === "dividendGrowth") || { condition: 'above' }).condition, eps: (ruleOfList?.find(item => item.name === "eps") || { condition: 'above' }).condition, growthEPS: (ruleOfList?.find(item => item.name === "growthEPS") || { condition: 'above' }).condition, pe: (ruleOfList?.find(item => item.name === "pe") || { condition: 'above' }).condition, @@ -146,6 +150,10 @@ const getStockScreenerData = async (rules) => { { rule: 'growthGrossProfit', label: 'Gross Profit Growth [%]', category: 'fund'}, { rule: 'researchAndDevelopmentExpenses', label: 'Research & Development (R&D) Expenses', category: 'fund'}, { rule: 'growthResearchAndDevelopmentExpenses', label: 'R&D Expenses Growth [%]', category: 'fund'}, + { rule: 'payoutRatio', label: 'Payout Ratio [%]',category: 'fund' }, + { rule: 'dividendYield', label: 'Dividend Yield [%]',category: 'fund' }, + { rule: 'annualDividend', label: 'Annual Dividend',category: 'fund' }, + { rule: 'dividendGrowth', label: 'Dividend Growth [%]',category: 'fund' }, { rule: 'eps', label: 'Earnings Per Share (EPS)',category: 'fund' }, { rule: 'growthEPS', label: 'EPS Growth [%]',category: 'fund' }, { rule: 'interestIncome', label: 'Interest Income',category: 'fund' }, @@ -219,6 +227,11 @@ const getStockScreenerData = async (rules) => { let valueGrowthNetIncome = (ruleOfList?.find(item => item.name === "growthNetIncome") || { value: 10 }).value; let valueGrossProfit = (ruleOfList?.find(item => item.name === "grossProfit") || { value: 50 }).value; let valueGrowthGrossProfit = (ruleOfList?.find(item => item.name === "growthGrossProfit") || { value: 10 }).value; + let valueDividendYield = (ruleOfList?.find(item => item.name === "dividendYield") || { value: 20 }).value; + let valueAnnualDividend = (ruleOfList?.find(item => item.name === "annualDividend") || { value: 1 }).value; + let valueDividendGrowth = (ruleOfList?.find(item => item.name === "dividendGrowth") || { value: 5 }).value; + let valuePayoutRatio = (ruleOfList?.find(item => item.name === "payoutRatio") || { value: 20 }).value; + let valueEPS = (ruleOfList?.find(item => item.name === "eps") || { value: 2 }).value; let valueGrowthEPS = (ruleOfList?.find(item => item.name === "growthEPS") || { value: 10 }).value; let valuePE = (ruleOfList?.find(item => item.name === "pe") || { value: 10 }).value; @@ -289,6 +302,10 @@ const valueMappings = { researchAndDevelopmentExpenses: valueResearchAndDevelopmentExpenses, growthResearchAndDevelopmentExpenses: valueGrowthResearchAndDevelopmentExpenses, eps: valueEPS, + dividendYield: valueDividendYield, + annualDividend: valueAnnualDividend, + dividendGrowth: valueDividendGrowth, + payoutRatio: valuePayoutRatio, growthEPS: valueGrowthEPS, interestIncome: valueInterestIncome, interestExpense: valueInterestExpenses, @@ -435,12 +452,16 @@ async function handleRule(newRule) { async function updateStockScreenerData() { try { const newData = await getStockScreenerData(ruleOfList); - stockScreenerData = newData?.filter(item => { - const ratingRecommendationExists = item?.ratingRecommendation !== null; - const trendAnalysisAccuracyExists = item?.trendAnalysis?.accuracy !== null; - const fundamentalAnalysisAccuracyExists = item?.fundamentalAnalysis?.accuracy !== null; - return ratingRecommendationExists && trendAnalysisAccuracyExists && fundamentalAnalysisAccuracyExists; - }); + stockScreenerData = newData?.filter(item => + item?.ratingRecommendation !== null && + item?.trendAnalysis?.accuracy !== null && + item?.fundamentalAnalysis?.accuracy !== null && + item?.dividendYield !== null && + item?.annualDividend !== null && + item?.dividendGrowth !== null && + item?.payoutRatio !== null + ); + filteredData = filterStockScreenerData(); displayResults = filteredData?.slice(0, 50); } catch (error) { @@ -589,6 +610,18 @@ $: { const ruleToUpdate = ruleOfList?.find(rule => rule.name === ruleName); if (ruleToUpdate) { switch (ruleToUpdate.name) { + case 'payoutRatio': + ruleToUpdate.value = valuePayoutRatio; + break; + case 'dividendGrowth': + ruleToUpdate.value = valueDividendGrowth; + break; + case 'dividendYield': + ruleToUpdate.value = valueDividendYield; + break; + case 'annualDividend': + ruleToUpdate.value = valueAnnualDividend; + break; case 'eps': ruleToUpdate.value = valueEPS; break; @@ -747,6 +780,7 @@ $: { } filteredData = filterStockScreenerData(); + if(ruleOfList?.some(item => item.name === 'ratingRecommendation')) { filteredData = filteredData?.filter(item => item?.ratingRecommendation === valueAnalyst) } @@ -801,8 +835,8 @@ function filterStockScreenerData() { return false; } } - - + + else { if (rule.condition === "above" && item[rule.name] !== null && item[rule.name] <= rule.value) { return false; @@ -1571,7 +1605,113 @@ $: charNumber = $screenWidth < 640 ? 20 : 40; {/if} - + + + {#if ruleName === 'payoutRatio'} + +