Example #1
0
        public static void SeedDatabase(SimpleStockAppDataContext dataContext)
        {
            System.Diagnostics.Debug.WriteLine("Start Creating Dow");
            var dow =
                new StockIndex()
            {
                Name   = "Dow Jones Industrial Average",
                Symbol = "^DJI"
            };

            dow.StockStockIndex = CreateStocksInDow(dow, dataContext);
            dataContext.StockIndexes.Add(dow);
            dataContext.SaveChanges();
            System.Diagnostics.Debug.WriteLine("Dow Done");

            System.Diagnostics.Debug.WriteLine("Start Creating Dax");
            var dax =
                new StockIndex()
            {
                Name   = "DAX",
                Symbol = "^GDAXI"
            };

            dax.StockStockIndex = CreateStocksInDax(dax, dataContext);
            dataContext.StockIndexes.Add(dax);
            dataContext.SaveChanges();
            System.Diagnostics.Debug.WriteLine("Dax Done");

            System.Diagnostics.Debug.WriteLine("Adding quotes started");
            AddRealTimeData(dataContext);
            System.Diagnostics.Debug.WriteLine("Adding Done");
        }
Example #2
0
        private static List <StockStockIndex> CreateStocksInDow(StockIndex stockIndex, SimpleStockAppDataContext dataContext)
        {
            var lst = new List <Stock>()
            {
                new Stock {
                    Symbol = "AAPL", Name = "Apple Inc.", Currency = "USD"
                },
                new Stock {
                    Symbol = "AXP", Name = "American Express Company", Currency = "USD"
                },
                new Stock {
                    Symbol = "BA", Name = "The Boeing Compan", Currency = "USD"
                },
                new Stock {
                    Symbol = "CSCO", Name = "Cisco systems", Currency = "USD"
                },
                new Stock {
                    Symbol = "GE", Name = "General Electric", Currency = "USD"
                },
                new Stock {
                    Symbol = "IBM", Name = "International Business Machines Corporation", Currency = "USD"
                },
                new Stock {
                    Symbol = "INTC", Name = "Intel Corporation", Currency = "USD"
                },
                new Stock {
                    Symbol = "JNJ", Name = "Johnson & Johnson", Currency = "USD"
                },
                new Stock {
                    Symbol = "JPM", Name = "JPMorgan Chase & Co.", Currency = "USD"
                },
                new Stock {
                    Symbol = "MMM", Name = "3M Company", Currency = "USD"
                },
                new Stock {
                    Symbol = "MSFT", Name = "Microsoft Corporation", Currency = "USD"
                },
                new Stock {
                    Symbol = "NKE", Name = "NIKE, Inc.", Currency = "USD"
                },
                new Stock {
                    Symbol = "V", Name = "Visa Inc", Currency = "USD"
                },
            };

            return(AddStockListToIndex(lst, stockIndex, dataContext));
        }
Example #3
0
        private static List <StockStockIndex> AddStockListToIndex(List <Stock> Stocks, StockIndex Index, SimpleStockAppDataContext dataContext)
        {
            var retVal = new List <StockStockIndex>();

            foreach (var item in Stocks)
            {
                if (dataContext.Stocks.Where(n => n.Symbol == item.Symbol).Count() == 0)
                {
                    dataContext.Stocks.Add(item);
                }
                retVal.Add(new StockStockIndex {
                    StockIndex = Index, Stock = item
                });
            }

            return(retVal);
        }
Example #4
0
        private static List <StockStockIndex> CreateStocksInDax(StockIndex index, SimpleStockAppDataContext dataContext)
        {
            var lst = new List <Stock>()
            {
                new Stock {
                    Symbol = "ADS.DE", Name = "Addidas", Currency = "EUR"
                },
                new Stock {
                    Symbol = "ALV.DE", Name = "Allianz SE", Currency = "EUR"
                },
                new Stock {
                    Symbol = "BAS.DE", Name = "BASF SE", Currency = "EUR"
                },
                new Stock {
                    Symbol = "BAYN.DE", Name = "Bayer Aktiengesellschaft ", Currency = "EUR"
                },
                new Stock {
                    Symbol = "BEI.DE", Name = "Beiersdorf Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "BMW.DE", Name = "Bayerische Motoren Werke Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "CBK.DE", Name = "Commerzbank AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "CON.DE", Name = "Continental Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "DAI.DE", Name = "Daimler AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "DB1.DE", Name = "Deutsche Börse Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "DBK.DE", Name = "Deutsche Bank Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "DPW.DE", Name = "Deutsche Post AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "DTE.DE", Name = "Deutsche Telekom AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "FME.DE", Name = "Fresenius Medical Care AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "FRE.DE", Name = "Fresenius SE & Co.", Currency = "EUR"
                },
                new Stock {
                    Symbol = "HEI.DE", Name = "HeidelbergCement AG", Currency = "EUR"
                },
                new Stock {
                    Symbol = "LHA.DE", Name = "Lufthansa", Currency = "EUR"
                },
                new Stock {
                    Symbol = "LIN.DE", Name = "Linde", Currency = "EUR"
                },
                new Stock {
                    Symbol = "SAP.DE", Name = "SAP SE", Currency = "EUR"
                },
                new Stock {
                    Symbol = "SIE.DE", Name = "Siemens Aktiengesellschaft", Currency = "EUR"
                },
                new Stock {
                    Symbol = "TKA.DE", Name = "ThyssenKrupp AG", Currency = "EUR"
                }
            };

            return(AddStockListToIndex(lst, index, dataContext));
        }