コード例 #1
0
        private List <GrahamAnalysis> PerformGrahamAnalysis(string ticker, string source, bool quarterly, double avgGrowth, double lastPeriodGrowth, double normEps)
        {
            if (quarterly)
            {
                normEps = normEps * 4;
            }

            double lowGrowth  = 0.20 * avgGrowth;
            double highGrowth = 1.3 * avgGrowth;

            // come up with some growth rates and scenario descriptions
            Dictionary <string, double> growthRates = new Dictionary <string, double> {
                { "Average Growth", avgGrowth },
                { "High Growth", 1.3 * highGrowth },
                { "Low Growth", 0.02 * avgGrowth },
                { "Zero Growth", 0 },
                { "Negative Growth", -0.02 },
                { "Last Period Growth", lastPeriodGrowth }
            };

            List <GrahamAnalysis> analysis = new List <GrahamAnalysis>();

            foreach (string key in growthRates.Keys)
            {
                GrahamAnalysis ga = new GrahamAnalysis
                {
                    Ticker        = ticker,
                    Source        = source,
                    IsQuarterly   = quarterly,
                    RiskFreeRate  = 4,
                    GrowthRate    = growthRates[key],
                    NormalizedEps = normEps
                };
                analysis.Add(ga);
            }

            return(analysis);
        }
コード例 #2
0
        private List<GrahamAnalysis> PerformGrahamAnalysis(string ticker, string source, bool quarterly, double avgGrowth, double lastPeriodGrowth, double normEps)
        {
            if (quarterly) normEps = normEps * 4;

            double lowGrowth = 0.20 * avgGrowth;
            double highGrowth = 1.3 * avgGrowth;

            // come up with some growth rates and scenario descriptions
            Dictionary<string, double> growthRates = new Dictionary<string, double>{
                {"Average Growth", avgGrowth},
                {"High Growth", 1.3 * highGrowth},
                {"Low Growth", 0.02 * avgGrowth},
                {"Zero Growth", 0},
                {"Negative Growth", -0.02},
                {"Last Period Growth", lastPeriodGrowth}
            };

            List<GrahamAnalysis> analysis = new List<GrahamAnalysis>();

            foreach (string key in growthRates.Keys)
            {
                GrahamAnalysis ga = new GrahamAnalysis
                {
                    Ticker = ticker,
                    Source = source,
                    IsQuarterly = quarterly,
                    RiskFreeRate = 4,
                    GrowthRate = growthRates[key],
                    NormalizedEps = normEps
                };
                analysis.Add(ga);
            }

            return analysis;
        }