Beispiel #1
0
        public void PriceBasicTest()
        {
            _priceBars      = new PriceBars(100);
            _priceBarReader = new PriceBarReader(_priceBars);

            TestFeedFactory testFeed = new TestFeedFactory();

            _maxwellFeed = testFeed.CreateMaxwellFeed(IntervalTypeOption.M1, DateTime.Now);

            _maxwellFeed.PushFeed += OnPushFeed;

            EMAOfPrices ema = new EMAOfPrices(3);

            ProbeReader <float, float> reader = ema.GetReader();

            IPriceEvaluate evaluator = ema;

            _maxwellFeed.PushNext(1);

            evaluator.Evaluate(_priceBarReader);

            Assert.AreEqual(0, reader.Count);

            _maxwellFeed.PushNext(1);

            evaluator.Evaluate(_priceBarReader);

            Assert.AreEqual(0, reader.Count);

            _maxwellFeed.PushNext(1);

            evaluator.Evaluate(_priceBarReader);

            Assert.AreEqual(0, reader.Count);

            _maxwellFeed.PushNext(1);

            evaluator.Evaluate(_priceBarReader);

            Assert.AreEqual(1, reader.Count);
            Assert.AreEqual(4, reader.Current);

            _maxwellFeed.PushNext(1);

            evaluator.Evaluate(_priceBarReader);

            Assert.AreEqual(2, reader.Count);
            Assert.AreEqual(4, reader.Current);
        }
Beispiel #2
0
        public void TestBookmarkedPriceBarWritesShouldWork()
        {
            PriceBars      priceBars = new PriceBars(10);
            PriceBarReader reader    = new PriceBarReader(priceBars);

            priceBars.NextPoolItem.Write(DateTime.Now, 1, 2, 3, 4);
            priceBars.MoveNext();

            Bookmark <IPriceBar> bookmark = reader.GetBookmark();

            Assert.AreEqual(priceBars.Current.Open, bookmark.Current.Open);

            priceBars.NextPoolItem.Write(DateTime.Now, 5, 6, 7, 8);
            priceBars.MoveNext();

            Assert.AreNotEqual(priceBars.Current.Open, bookmark.Current.Open);
        }