コード例 #1
0
        public LevermannParameter GetLevermannParameters(string stockQuote)
        {
            var result = new LevermannParameter();

            JObject detailsData    = GetDetailsData(stockQuote);
            JObject financialsData = GetFinancialsData(stockQuote);
            string  wsjHtmlCode    = GetWsjHtmlCode(stockQuote);

            // 1. RoE - Return on Equity
            result.RoE = CalculateRoE(detailsData);

            // 2. EBIT margin
            result.EBITMargin = CalculateEBITMargin(financialsData);

            // 3. Equity ratio = total shareholders equity / total assets
            result.EquityRatio = CalculateEquityRatio(financialsData);

            // 4. P/E ratio 1 year
            result.PE1year = CalculatePE1year(detailsData);

            // 5. P/E ratio 5 years
            result.PE5years = CalculatePE5years(stockQuote, detailsData);

            // 6. Analyst opinions
            result.AnalystOpinions = CalculateAnalystOpinions(wsjHtmlCode);

            // 7. Reactions to quarterly figures relase
            result.ReactionToQuarterlyRelease = CalculateReactionToQuarterlyRelease(stockQuote, detailsData);

            // 8. Profit revision
            // The difference between the analysts’ estimates for earnings per share of 4 weeks ago is compared with the current expectations.
            // This is done for current fiscal year and next fiscal year.
            result.ProfitRevision = CalculateProfitRevision(wsjHtmlCode);

            // 9. Price change 6 months
            result.PriceChange6months = CalculatePriceChange6months(stockQuote);

            // 10. Price change 12 months
            result.PriceChange12months = CalculatePriceChange12months(stockQuote);

            // 11. Price momentum
            result.PriceMomentum = CalculatePriceMomentum(result.PriceChange6months, result.PriceChange12months);

            // 12. Reversal effect
            // Compare to the benchmark index for the last 3 months.
            result.ReversalEffect = CalculateReversalEffect(stockQuote);

            // 13. Profit growth
            // The difference between the profit forecast for the next year and the profit forecast for the current year.
            result.ProfitGrowth = CalculateProfitGrowth(wsjHtmlCode);

            return(result);
        }
コード例 #2
0
        public LevermannFinalPoint GetLevermannFinalPoints(LevermannParameter levermannParameters, bool isFinancial = false)
        {
            double tolerance;
            var    result = new LevermannFinalPoint();

            // 1
            // +1, if the return on equity is greater than 20 %.
            // 0, if the return on equity is between 10 and 20 %.
            // - 1, if the return on equity is less than 10 %.
            tolerance = 0.3;
            if (levermannParameters.RoE >= 20 - tolerance)
            {
                result.RoE = 1;
            }
            if (levermannParameters.RoE < 10 - tolerance)
            {
                result.RoE = -1;
            }

            // 2
            // +1, if the EBIT-Margin is greater than 12%.
            // 0, if the EBIT-Margin is between 6 and 12%.
            // -1, if the EBIT-Margin is less than 6%.
            tolerance = 0.2;
            if (levermannParameters.EBITMargin >= 12 - tolerance)
            {
                result.EBITMargin = 1;
            }
            if (levermannParameters.EBITMargin < 6 - tolerance)
            {
                result.EBITMargin = -1;
            }
            if (isFinancial)
            {
                result.EBITMargin = 0;
            }

            // 3
            // +1, if the equity ratio is greater than 25%.
            // 0, if the equity ratio is between 15 and 25%.
            // -1, if the equity ratio is less than 15%.
            tolerance = 0.5;
            if (levermannParameters.EquityRatio >= 25 - tolerance)
            {
                result.EquityRatio = 1;
            }
            if (levermannParameters.EquityRatio < 15 - tolerance)
            {
                result.EquityRatio = -1;
            }
            if (isFinancial)
            {
                if (levermannParameters.EquityRatio >= 10 - tolerance)
                {
                    result.EquityRatio = 1;
                }
                if (levermannParameters.EquityRatio < 5 - tolerance)
                {
                    result.EquityRatio = -1;
                }
            }

            // 4
            // +1, if the P/E ratio is less than 12, but greater than 0.
            // 0 if the P/E ratio is between 12 and 16.
            // -1, if the P/E ratio is greater than 16 or less than 0.
            tolerance = 0.2;
            if (levermannParameters.PE1year > 0 && levermannParameters.PE1year <= 12 + tolerance)
            {
                result.PE1year = 1;
            }
            if (levermannParameters.PE1year > 16 + tolerance)
            {
                result.PE1year = -1;
            }

            // 5
            if (levermannParameters.PE5years > 0 && levermannParameters.PE5years <= 12 + tolerance)
            {
                result.PE5years = 1;
            }
            if (levermannParameters.PE5years > 16 + tolerance)
            {
                result.PE5years = -1;
            }

            // 6
            // +1, if the factor is greater than or equal to 2,5.
            // 0, if the factor is between 1,5 and 2,5.
            // -1, if the factor is less than or equal to 1,5.
            tolerance = 0.1;
            if (levermannParameters.AnalystOpinions >= 2.5 - tolerance)
            {
                result.AnalystOpinions = 1;
            }
            if (levermannParameters.AnalystOpinions < 1.5 - tolerance)
            {
                result.AnalystOpinions = -1;
            }

            // 7
            // +1, if the adjusted performance is greater than 1%.
            // -1 if the adjusted performance is less than -1%.
            tolerance = 0;
            if (levermannParameters.ReactionToQuarterlyRelease >= 1 - tolerance)
            {
                result.ReactionToQuarterlyRelease = 1;
            }
            if (levermannParameters.ReactionToQuarterlyRelease < -1 - tolerance)
            {
                result.ReactionToQuarterlyRelease = -1;
            }

            // 8
            // +1, if the profit revision is greater than 5%.
            // 0, if the profit revision is between -5% and + 5%.
            // -1 if the profit revision is less than -5%.
            tolerance = 0.1;
            if (levermannParameters.ProfitRevision >= 5 - tolerance)
            {
                result.ProfitRevision = 1;
            }
            if (levermannParameters.ProfitRevision < -5 - tolerance)
            {
                result.ProfitRevision = -1;
            }

            // 9
            // +1, if the price has risen more than + 5% over the period.
            // 0, if the price has changed between -5% and + 5% during the period.
            // -1, if the price has fallen more than -5% over the period.
            tolerance = 0.1;
            if (levermannParameters.PriceChange6months >= 5 - tolerance)
            {
                result.PriceChange6months = 1;
            }
            if (levermannParameters.PriceChange6months < -5 - tolerance)
            {
                result.PriceChange6months = -1;
            }

            // 10
            if (levermannParameters.PriceChange12months >= 5 - tolerance)
            {
                result.PriceChange12months = 1;
            }
            if (levermannParameters.PriceChange12months < -5 - tolerance)
            {
                result.PriceChange12months = -1;
            }

            // 11
            result.PriceMomentum = levermannParameters.PriceMomentum;

            // 12
            result.ReversalEffect = levermannParameters.ReversalEffect;

            // 13
            // +1, if earnings growth is greater than 5%.
            // 0, if earnings growth is between -5% and +5%.
            // -1, if earnings growth is less than -5%.
            tolerance = 0.1;
            if (levermannParameters.ProfitGrowth >= 5 - tolerance)
            {
                result.ProfitGrowth = 1;
            }
            if (levermannParameters.ProfitGrowth < -5 - tolerance)
            {
                result.ProfitGrowth = -1;
            }

            return(result);
        }
コード例 #3
0
 public void EvaluateMotherFuckerr(string stockQuote, bool isFinancial = false)
 {
     levermannParameters    = GetLevermannParameters(stockQuote);
     levermannFinalPoints   = GetLevermannFinalPoints(levermannParameters, isFinancial);
     shortQuoteNameAndPrice = GetShortQuoteNameAndPrice(stockQuote);
 }
コード例 #4
0
 public TheMotherEvaluator()
 {
     _driver              = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
     levermannParameters  = new LevermannParameter();
     levermannFinalPoints = new LevermannFinalPoint();
 }