From e0323103bf87fe1ac8aaab8a5fbb5916aad027da Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 17 Jul 2024 15:13:56 +0200 Subject: [PATCH] add forwardPE to stock screener --- src/lib/components/BorrowedShare.svelte | 4 +++ .../stock-screener/[strategyId]/+page.svelte | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/src/lib/components/BorrowedShare.svelte b/src/lib/components/BorrowedShare.svelte index fbcbe971..46759fdc 100644 --- a/src/lib/components/BorrowedShare.svelte +++ b/src/lib/components/BorrowedShare.svelte @@ -99,6 +99,10 @@ function findLowestAndHighestFee(data, lastDateStr) { const option = { silent: true, + tooltip: { + trigger: 'axis', + hideDelay: 100, // Set the delay in milliseconds + }, animation: $screenWidth < 640 ? false: true, grid: { left: '2%', diff --git a/src/routes/stock-screener/[strategyId]/+page.svelte b/src/routes/stock-screener/[strategyId]/+page.svelte index 9f5bd0d9..0f74440f 100644 --- a/src/routes/stock-screener/[strategyId]/+page.svelte +++ b/src/routes/stock-screener/[strategyId]/+page.svelte @@ -66,6 +66,7 @@ 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, + forwardPE: (ruleOfList?.find(item => item.name === "forwardPE") || { condition: 'above' }).condition, beta: (ruleOfList?.find(item => item.name === "beta") || { condition: 'above' }).condition, ebitda: (ruleOfList?.find(item => item.name === "ebitda") || { condition: 'above' }).condition, growthEBITDA: (ruleOfList?.find(item => item.name === "growthEBITDA") || { condition: 'above' }).condition, @@ -141,6 +142,7 @@ { rule: 'operatingIncome', label: 'Operating Income',category: 'fund' }, { rule: 'growthOperatingIncome', label: 'Operating Income Growth [%]',category: 'fund' }, { rule: 'pe', label: 'Price per Earnings (PE)', category: 'fund'}, + { rule: 'forwardPE', label: 'Forward PE', category: 'fund'}, { rule: 'priceToBookRatio', label: 'Price to Book Ratio (PB)', category: 'fund'}, { rule: 'priceToSalesRatio', label: 'Price to Sales Ratio (PS)', category: 'fund'}, { rule: 'beta', label: 'Beta', category: 'fund'}, @@ -206,6 +208,8 @@ 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; + let valueForwardPE = (ruleOfList?.find(item => item.name === "forwardPE") || { value: 10 }).value; + let valuePriceToBookRatio = (ruleOfList?.find(item => item.name === "priceToBookRatio") || { value: 5 }).value; let valuePriceToSalesRatio = (ruleOfList?.find(item => item.name === "priceToSalesRatio") || { value: 10 }).value; let valueBeta = (ruleOfList?.find(item => item.name === "beta") || { value: 1 }).value; @@ -280,6 +284,7 @@ const valueMappings = { operatingIncome: valueOperatingIncome, growthOperatingIncome: valueGrowthOperatingIncome, pe: valuePE, + forwardPE: valueForwardPE, priceToBookRatio: valuePriceToBookRatio, priceToSalesRatio: valuePriceToSalesRatio, beta: valueBeta, @@ -331,6 +336,7 @@ const conditions = { operatingIncome: ruleCondition.operatingIncome, growthOperatingIncome: ruleCondition.growthOperatingIncome, pe: ruleCondition.pe, + forwardPE: ruleCondition.forwardPE, priceToBookRatio: ruleCondition.priceToBookRatio, priceToSalesRatio: ruleCondition.priceToSalesRatio, beta: ruleCondition.beta, @@ -569,6 +575,9 @@ $: { case 'pe': ruleToUpdate.value = valuePE; break; + case 'forwardPE': + ruleToUpdate.value = valueForwardPE; + break; case 'priceToBookRatio': ruleToUpdate.value = valuePriceToBookRatio; break; @@ -1573,6 +1582,30 @@ $: { {/if} + + {#if ruleName === 'forwardPE'} +
+ Forward PE {ruleCondition[ruleName]} {valueForwardPE} + + + + +
+ +
+ + +
+ + {/if} + + {#if ruleName === 'priceToBookRatio'}