Exemple #1
0
        public void IndexEodTest()
        {
            var candles = Stooq.GetHistoricalAsync("^SPX", Period.Daily, new DateTime(2017, 1, 3), ascending: true).Result;
            var candle  = candles.First();

            Assert.Equal(candle.DateTime, new DateTime(2017, 1, 3));
            Assert.Equal(2251.57m, candle.Open);
            Assert.Equal(2263.88m, candle.High);
            Assert.Equal(2245.13m, candle.Low);
            Assert.Equal(2257.83m, candle.Close);
            Assert.Equal(644_640_832, candle.Volume);
        }
Exemple #2
0
        public void EodTest()
        {
            var candles = Stooq.GetHistoricalAsync("aapl.us", Period.Daily, new DateTime(2017, 1, 3), ascending: true).Result;
            var candle  = candles.First();

            Assert.Equal(candle.DateTime, new DateTime(2017, 1, 3));
            Assert.Equal(candle.Open, 114.83m);
            Assert.Equal(candle.High, 115.35m);
            Assert.Equal(candle.Low, 113.79m);
            Assert.Equal(candle.Close, 115.17m);
            Assert.Equal(candle.Volume, 27_975_430);
        }
Exemple #3
0
        public void DateTimeTest()
        {
            // Bug: Stooq returns empty csv if start date < the particular date, no candle can be retrieved in this case
            //         var candle = Stooq.GetHistoricalAsync("^SPX", Period.Daily, ascending: true).Result;
            //         Assert.Equal(candle.First().DateTime, new DateTime(1789, 5, 1));
            //Thread.Sleep(1000);

            var candle2 = Stooq.GetHistoricalAsync("^SPX", Period.Daily, new DateTime(2017, 1, 3), ascending: true).Result;

            Assert.Equal(candle2.First().DateTime, new DateTime(2017, 1, 3));
            Thread.Sleep(1000);

            var candle3 = Stooq.GetHistoricalAsync("^SPX", Period.Daily, new DateTime(2017, 1, 3), new DateTime(2017, 2, 3), ascending: true).Result;

            Assert.Equal(candle3.First().DateTime, new DateTime(2017, 1, 3));
            Assert.Equal(candle3.Last().DateTime, new DateTime(2017, 2, 3));
            Thread.Sleep(1000);

            // Bug: Stooq returns empty csv if start date < the particular date, no candle can be retrieved in this case
            //var candle4 = Stooq.GetHistoricalAsync("^SPX", Period.Daily, endTime: new DateTime(2017, 2, 3), ascending: true).Result;
            //Assert.Equal(candle4.Last().DateTime, new DateTime(2017, 2, 3));
        }