コード例 #1
0
        public void TestSetupCursor()
        {
            var stream = new BacktestTickerCursorStream(quoteFolder, "INDUSD");

            Assert.IsNotNull(stream.currentCandle, "TestSetupCursor() - should read candle");
            Assert.IsNotNull(stream.nextCandle, "TestSetupCursor() - should read next candle");
        }
コード例 #2
0
        public void TestMoveToTime()
        {
            var        stream = new BacktestTickerCursorStream(quoteFolder, "INDUSD");
            var        time   = stream.currentCandle.timeClose.AddMinutes(30);
            CandleData candle;
            var        moveResult = stream.MoveToTime(time, out candle);

            Assert.IsTrue(moveResult, "TestMoveToTime() - should step on time");
            Assert.IsNotNull(candle, "TestMoveToTime() - should return candle");
            Assert.AreEqual(candle.timeClose, time, "TestMoveToTime() - should step on the right time");

            time       = time.AddMinutes(-20);
            moveResult = stream.MoveToTime(time, out candle);
            Assert.IsTrue(moveResult, "TestMoveToTime() - should step on time (rewind)");
            Assert.IsNotNull(candle, "TestMoveToTime() - should return candle after rewind");
            Assert.AreEqual(candle.timeClose, time, "TestMoveToTime() - should step on the right time after rewind");
        }