Esempio n. 1
0
        public void DefaultEndDate()
        {
            var startDate = DateTime.UtcNow.Date.AddDays(-7);

            // Expected end date should be either today if tradable, or last tradable day
            var aapl         = _qb.AddEquity("AAPL");
            var now          = DateTime.UtcNow.Date;
            var expectedDate = aapl.Exchange.Hours.IsDateOpen(now) ? now : aapl.Exchange.Hours.GetPreviousTradingDay(now);

            IEnumerable <DataDictionary <dynamic> > data = _qb.GetFundamental("AAPL", "ValuationRatios.PERatio", startDate);

            // Check that the last day in the collection is as expected
            var lastDay = data.Last();

            Assert.AreEqual(expectedDate, lastDay.Time);
        }
Esempio n. 2
0
        public void CSharpReturnNullTest(dynamic input)
        {
            var qb   = new QuantBook();
            var data = qb.GetFundamental(input[0], input[1], input[2], input[3]);

            Assert.IsEmpty(data);
        }
        public void DefaultEndDate()
        {
            var qb           = new QuantBook();
            var startDate    = DateTime.UtcNow.Date.AddDays(-2);
            var expectedDate = DateTime.UtcNow.Date;
            IEnumerable <DataDictionary <dynamic> > data = qb.GetFundamental("AAPL", "ValuationRatios.PERatio", startDate);

            // Check that the last day in the collection is as expected (today)
            var lastDay = data.Last();

            Assert.AreEqual(expectedDate, lastDay.Time);
        }
Esempio n. 4
0
        public void CSharpFundamentalData(dynamic input)
        {
            var qb   = new QuantBook();
            var data = qb.GetFundamental(input[0], input[1], _startDate, _endDate);

            foreach (var day in data)
            {
                foreach (var value in day.Values)
                {
                    Assert.AreEqual(input[2], value);
                    Assert.AreEqual(_startDate, day.Time);
                }
            }
        }