コード例 #1
0
        public void FillsForwardBidAskBars()
        {
            var bar1 = new QuoteBar
            {
                Bid = new Bar(3m, 4m, 1m, 2m),
                Ask = new Bar(3.1m, 4.1m, 1.1m, 2.1m),
            };

            var bar2 = new QuoteBar
            {
                Bid = null,
                Ask = null,
            };

            var data = new[] { bar1, bar2 }.ToList();
            var enumerator = data.GetEnumerator();

            var fillForwardEnumerator = new QuoteBarFillForwardEnumerator(enumerator);

            // 9:31
            Assert.IsTrue(fillForwardEnumerator.MoveNext());
            var quoteBar1 = (QuoteBar)fillForwardEnumerator.Current;

            Assert.AreSame(bar1.Bid, quoteBar1.Bid);
            Assert.AreSame(bar1.Ask, quoteBar1.Ask);

            // 9:32
            Assert.IsTrue(fillForwardEnumerator.MoveNext());
            var quoteBar2 = (QuoteBar)fillForwardEnumerator.Current;

            Assert.AreSame(quoteBar1.Bid, quoteBar2.Bid);
            Assert.AreSame(quoteBar1.Ask, quoteBar2.Ask);

            fillForwardEnumerator.Dispose();
        }