Esempio n. 1
0
        private static void QuandlSequentialScrape()
        {
            var api = new QuandlApi();

            List<Company> companies = new List<Company>();

            var scraped = new List<string>();

            using (var db = new CapstoneContext())
            {
                companies = db.Companies.ToList();

                scraped = db.QStockPrices.GroupBy(p => p.CompanyId).Select(p => p.Key).ToList();
            }

            foreach (var company in companies)
            {

                using (var db = new CapstoneContext())
                {
                    scraped = db.QStockPrices.GroupBy(p => p.CompanyId).Select(p => p.Key).ToList();
                }

                if (!scraped.Contains(company.StockId))
                {
                    api.ScrapeAllPrice(company.StockId);
                }
                else
                {
                    Console.WriteLine(company.StockId + " FINISHED");
                }
            }
        }
Esempio n. 2
0
        private static void scrapOneCompany()
        {
            var api = new QuandlApi();

            List<Company> companies = new List<Company>();

            var scraped = new List<string>();

            using (var db = new CapstoneContext())
            {
                companies = db.Companies.ToList();

                scraped = db.QStockPrices.GroupBy(p => p.CompanyId).Select(p => p.Key).ToList();
            }

            var com = companies.First(c => !(scraped.Contains(c.StockId)));

            api.ScrapeAllPrice(com.StockId);

            Console.WriteLine("Finished");
            Console.ReadLine();
        }