Ejemplo n.º 1
0
        public void addBar()
        {
            defaultSeries = new BaseTimeSeries();
            IBar firstBar  = new MockBar(new DateTime(2014, 6, 13, 0, 0, 0, 0), 1M);
            IBar secondBar = new MockBar(new DateTime(2014, 6, 14, 0, 0, 0, 0), 2M);

            Assert.AreEqual(0, defaultSeries.GetBarCount());
            Assert.AreEqual(-1, defaultSeries.GetBeginIndex());
            Assert.AreEqual(-1, defaultSeries.GetEndIndex());

            defaultSeries.AddBar(firstBar);
            Assert.AreEqual(1, defaultSeries.GetBarCount());
            Assert.AreEqual(0, defaultSeries.GetBeginIndex());
            Assert.AreEqual(0, defaultSeries.GetEndIndex());

            defaultSeries.AddBar(secondBar);
            Assert.AreEqual(2, defaultSeries.GetBarCount());
            Assert.AreEqual(0, defaultSeries.GetBeginIndex());
            Assert.AreEqual(1, defaultSeries.GetEndIndex());
        }
Ejemplo n.º 2
0
 public void addNullBarshouldThrowException()
 {
     Assert.ThrowsException <ArgumentNullException>(() => defaultSeries.AddBar(null));
 }
Ejemplo n.º 3
0
 public void init()
 {
     data = new BaseTimeSeries();
     data.AddBar(new BaseBar(DateTime.Now.AddDays(1), 168.28M, 169.87M, 167.15M, 169.64M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(2), 168.84M, 169.36M, 168.2M, 168.71M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(3), 168.88M, 169.29M, 166.41M, 167.74M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(4), 168M, 168.38M, 166.18M, 166.32M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(5), 166.89M, 167.7M, 166.33M, 167.24M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(6), 165.25M, 168.43M, 165M, 168.05M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(7), 168.17M, 170.18M, 167.63M, 169.92M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(8), 170.42M, 172.15M, 170.06M, 171.97M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(9), 172.41M, 172.92M, 171.31M, 172.02M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(10), 171.2M, 172.39M, 169.55M, 170.72M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(11), 170.91M, 172.48M, 169.57M, 172.09M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(12), 171.8M, 173.31M, 170.27M, 173.21M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(13), 173.09M, 173.49M, 170.8M, 170.95M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(14), 172.41M, 173.89M, 172.2M, 173.51M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(15), 173.87M, 174.17M, 175M, 172.96M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(16), 173M, 173.17M, 172.06M, 173.05M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(17), 172.26M, 172.28M, 170.5M, 170.96M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(18), 170.88M, 172.34M, 170.26M, 171.64M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(19), 171.85M, 172.07M, 169.34M, 170.01M, 0));
     data.AddBar(new BaseBar(DateTime.Now.AddDays(20), 170.75M, 172.56M, 170.36M, 172.52M, 0)); // FB, daily, 9.19.'17
 }