コード例 #1
0
ファイル: TestBar.cs プロジェクト: rebider/TradeLinkProj
        public void Construction()
        {
            BarImpl b = new BarImpl();

            Assert.That(!b.isValid);
            Assert.That(!b.isNew);
            b.newTick(ticklist[0]);
            Assert.That(b.isValid);
            Assert.That(b.isNew);
            b.newTick(ticklist[1]);
            Assert.That(b.isValid);
            Assert.That(!b.isNew);
            Assert.That(b.Volume == 200);
            b.newTick(TickImpl.NewQuote(sym, d, t, 10m, 11m, 1, 1, x, x));
            Assert.That(b.TradeCount == 2);
        }
コード例 #2
0
ファイル: TestBar.cs プロジェクト: rebider/TradeLinkProj
        public void BarIntervals()
        {
            BarImpl b       = new BarImpl(BarInterval.FiveMin);
            int     accepts = 0;

            foreach (TickImpl k in ticklist)
            {
                if (b.newTick(k))
                {
                    accepts++;
                }
            }
            Assert.AreEqual(5, accepts);

            b       = new BarImpl(BarInterval.FifteenMin);
            accepts = 0;
            foreach (TickImpl k in ticklist)
            {
                if (b.newTick(k))
                {
                    accepts++;
                }
            }
            Assert.AreEqual(9, accepts);

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