示例#1
0
文件: TestBar.cs 项目: w1r2p1/Core-1
        public void Construction()
        {
            BarImpl b = new BarImpl();

            Assert.True(!b.IsValid);
            Assert.True(!b.IsNew);
            b.NewTick(_ticklist[0]);
            Assert.True(b.IsValid);
            Assert.True(b.IsNew);
            b.NewTick(_ticklist[1]);
            Assert.True(b.IsValid);
            Assert.True(!b.IsNew);
            Assert.True(b.Volume == 200);
            b.NewTick(TickImpl.NewQuote(Sym, D, T, 10m, 11m, 1, 1, X, X));
            Assert.True(b.TradeCount == 2);
        }
示例#2
0
文件: TestBar.cs 项目: w1r2p1/Core-1
        public void BarIntervals()
        {
            BarImpl b       = new BarImpl(BarInterval.FiveMin);
            int     accepts = _ticklist.Count(k => b.NewTick(k));

            Assert.Equal(5, accepts);

            b       = new BarImpl(BarInterval.FifteenMin);
            accepts = _ticklist.Count(k => b.NewTick(k));
            Assert.Equal(9, accepts);

            b       = new BarImpl(BarInterval.Minute);
            accepts = 0;
            for (int i = 7; i < _ticklist.Length; i++)
            {
                if (b.NewTick(_ticklist[i]))
                {
                    accepts++;
                }
            }
            Assert.Equal(2, accepts);
        }