Ejemplo n.º 1
0
        public void AddNewFactor()
        {
            var factors = _client.Factors;
            var @new    = new InvestmentInfluenceFactor
            {
                Description = "Odata Test Description",
                Name        = "OData Test Name",
                Influence   = "Odata Test Influence"
            };

            _client.AddToFactors(@new);

            _client.SaveChanges();
        }
        protected override void Seed(ApplicationDbContext db)
        {
            var factors = new List <InvestmentInfluenceFactor> {
                new InvestmentInfluenceFactor {
                    Name      = "Weather", Description = "The climate will affect the investment.",
                    Influence = "Sunny weather helps, rainy weather doesn't"
                },
                new InvestmentInfluenceFactor {
                    Name      = "Competiion", Description = "The competition dictates te supply and demand",
                    Influence = "The more cometition the less buiness you get if the competition or on par to you"
                },
            };

            String[] sampleFactors = new String[]
            {
                "Healthcare industry performace",
                "Popularity",
                "Weather conditions",
                "Services Industry growth",
                "Fitness industry growth",
                "Fitness industry growth",
                "Current Weight/obiesity trend",
                "Physical paper services industry",
                "Woman's desire for beauty",
                "Trend for exotic cuisine",
                "Apitite for reading",
                "Apitite for TV boxsets",
                "Apitite for Gaming",
            };
            foreach (String each in sampleFactors)
            {
                InvestmentInfluenceFactor f = new InvestmentInfluenceFactor {
                    Name = each, Description = "description about " + each
                };
                f.Influence = "influenced by " + each;
                factors.Add(f);
            }
            factors.ForEach(f => f.Investments = new List <Investment>());
            factors.ForEach(f => db.Factors.Add(f));
            db.SaveChanges();

            var groups = new List <InvestmentGroup> {
                new InvestmentGroup {
                    Name = "Transport", Description = "Related to transport", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Travel/Tourism", Description = "Related to travel and tourism", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Utilities", Description = "Related to utilities etc.", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Telecommunications", Description = "Related to telecomms", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Professional Services/Consulting", Description = "Related to consulting", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Pharmaceutical/Medical Product", Description = "Medical related", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Oil/Gas", Description = "Oil and gas related", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Mining/Metals", Description = "Relating to Mining", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Manufacturing", Description = "Related to the manufacuring sector", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "IT (Hardware/Software/Services)", Description = "Related to IT sector", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Investment Banking", Description = "Investment banking related", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Food and Beverage", Description = "Relatin to food and consumables and drinks", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Consumer Goods", Description = "Related to consumer goods", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Agriculture", Description = "Related to farming and growing/producing", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "Unmanned aircraft", Description = "Related to unmanned aircraft", Type = "Vested interest"
                },
                new InvestmentGroup {
                    Name = "Personal Goods", Description = "Consumables for ones person", Type = "Sector"
                },
                new InvestmentGroup {
                    Name = "South Africa", Description = "Country at the furtherest reach of Africa", Type = "Region"
                },
                new InvestmentGroup {
                    Name = "Steel", Description = "Commodity prized for its strength and durability", Type = "Dependency"
                },
                new InvestmentGroup {
                    Name = "Software design consulting", Description = "Bespoke advice in software design issues", Type = "Service"
                },
                new InvestmentGroup {
                    Name = "Finance", Description = "Economic and financial part of the economy", Type = "Industry"
                },
                new InvestmentGroup {
                    Name = "Value Investments", Description = "high current p/e with potential to maintain.", Type = "Investment Type"
                },
                new InvestmentGroup {
                    Name = "Growth Investments", Description = "Low p/e with potential to grow", Type = "Investment Type"
                },
                new InvestmentGroup {
                    Name = "Momentum Investments", Description = "Fashionalble trends", Type = "Investment Type"
                },
                new InvestmentGroup {
                    Name = "Hybrid Investments", Description = "Bit of everything", Type = "Investment Type"
                },
                new InvestmentGroup {
                    Name = "Tactical", Description = "carefully considered group", Type = "Investment Strategy"
                },
                new InvestmentGroup {
                    Name = "Strategic", Description = "Assets with a strategic goal associated with them", Type = "Investment Strategy"
                },
                new InvestmentGroup {
                    Name = "Shares", Description = "Equity in company shares - fractional part owner", Type = "Container"
                },
                new InvestmentGroup {
                    Name = "Gold", Description = "ommodity which is valuable when markets are volatile", Type = "Container"
                },
                new InvestmentGroup {
                    Name = "Emerging markets", Description = "places like Japan, Turkey, Brazil, Taiwan etc.", Type = "Region"
                },
            };

            groups.ForEach(g => g.Investments = new List <Investment>());
            groups.ForEach(g => db.Groups.Add(g));

            db.SaveChanges();

            var regions = new List <Region> {
                new Region {
                    Name = "UK ALL COMPANIES", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "UK SMALLER COMPANIES", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "JAPAN", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "JAPANESE SMALLER COMPANIES", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "ASIA PACIFIC EXCLUDING JAPAN", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "CHINA / GREATER CHINA SECTOR", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "NORTH AMERICA", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "NORTH AMERICAN SMALLER COMPANIES", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "EUROPE INCLUDING UK", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "EUROPE EXCLUDING UK", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "EUROPEAN SMALLER COMPANIES", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "GLOBAL", Description = "(Fund Sector)"
                },
                new Region {
                    Name = "GLOBAL EMERGING MARKETS", Description = "(Fund Sector)"
                }
            };

            regions.ForEach(r => r.Investments = new List <Investment>());
            regions.ForEach(r => db.Regions.Add(r));
            db.SaveChanges();

            var risks = new List <InvestmentRisk> {
                new InvestmentRisk {
                    Name = "Director dismissal", Description = "Financial officer fired due to corruption", Type = Common.RiskType.Company
                },
                new InvestmentRisk {
                    Name = "Competition", Description = "Competition from other companies", Type = Common.RiskType.Company
                },
                new InvestmentRisk {
                    Name = "Trends/Fashion", Description = "Fashion/popularity of the comodity", Type = Common.RiskType.Company
                },
                new InvestmentRisk {
                    Name = "Earnings report", Description = "Investor perception based on earnings", Type = Common.RiskType.Company
                },
            };

            risks.ForEach(r => r.Investments = new List <Investment>());
            risks.ForEach(r => db.Risks.Add(r));
            db.SaveChanges();
            ;
            var investments = new List <Investment>();
            var random      = new Random();

            foreach (var investment in MakeRealInvestments())
            {
                investment.InitialInvestment = new Random().Next(100);
                investment.Value             = random.Next(0, 100);

                investment.Factors = new List <InvestmentInfluenceFactor>();
                investment.Groups  = new List <InvestmentGroup>();
                investment.Regions = new List <Region>();
                investment.Risks   = new List <InvestmentRisk>();

                var ShouldRandomlyAssignToInvestment = false;
                if (ShouldRandomlyAssignToInvestment)
                {
                    RandomlyAssignToInvestment(factors, groups, regions, risks, investment);
                }
                investments.Add(investment);
            }

            investments.ForEach(inv => db.Investments.Add(inv));
            db.SaveChanges();

            base.Seed(db);
        }