Esempio n. 1
0
        public void GetHistoricalDailyStockQuotesTest()
        {
            var target = new YahooFinance();
            string symbol = "MCD";
            DateTime startDate = new DateTime(2014, 1, 1);
            DateTime endDate = new DateTime(2014, 3, 31);

            var results = target.GetHistoricalDailyStockQuotes(symbol, startDate, endDate);
            var count = results.Count();

            Assert.AreEqual(61, count);
        }
        public void WriteStockQuotes()
        {
            var target = new YahooFinance();
            string symbol = "KO";
            DateTime startDate = new DateTime(2014, 1, 1);
            DateTime endDate = new DateTime(2014, 3, 31);

            var results = target.GetHistoricalDailyStockQuotes(symbol, startDate, endDate);

            var datastore = new GoogleCloudDatastore("Pogo");

            using (var session = datastore.OpenSession())
            {
                foreach (var quote in results)
                {
                    session.Store(quote);
                }

                session.SaveChanges();
            }
        }