Пример #1
0
        public void Test_DataRetrieval()
        {
            var ds = DataSourceFromBars.New("tiingo:msft");

            ds.LoadData(DateTime.Parse("01/01/2019"), DateTime.Parse("01/12/2019"));

            Assert.IsTrue(ds.Info[TuringTrader.Simulator.DataSourceParam.name].ToLower().Contains("microsoft"));
            Assert.IsTrue(((DateTime)ds.FirstTime).Date == DateTime.Parse("03/13/1986"));
            //Assert.IsTrue(((DateTime)ds.LastTime).Date == DateTime.Parse("01/11/2019"));
            Assert.IsTrue(ds.Data.Count() == 8);
            Assert.IsTrue(Math.Abs(ds.Data.Last().Close / ds.Data.First().Open - 102.36056 / 99.12445) < 1e-3);
        }
        public void Test_DataRetrieval()
        {
            var ds = DataSourceFromBars.New("fred:GDPC1");

            ds.LoadData(DateTime.Parse("09/30/2018"), DateTime.Parse("01/03/2019"));

            Assert.IsTrue(ds.Info[TuringTrader.Simulator.DataSourceParam.name].ToLower().Contains("real gross domestic product"));
            Assert.IsTrue(((DateTime)ds.FirstTime).Date == DateTime.Parse("01/01/1947"));
            //Assert.IsTrue(((DateTime)ds.LastTime).Date == DateTime.Parse("01/11/2019"));
            Assert.IsTrue(ds.Data.Count() == 64);
            Assert.IsTrue(Math.Abs(ds.Data.First().Open - 18765.256) < 1e-2);
            Assert.IsTrue(Math.Abs(ds.Data.Last().Close - 18912.326) < 1e-2);
        }