Example #1
0
        public void AddIntervalWhileRunning()
        {
            OHLCBarStream blt = new OHLCBarStream(new ForexSecurity("TST"));

            blt.AddInterval(BarInterval.Minute);
            blt.AddInterval(BarInterval.FiveMin);
            blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar);

            Tick[] tape = TestBarList.SampleData();
            blt.Initialize();

            // add ticks from tape to tracker
            for (int i = 0; i < tape.Length; i++)
            {
                blt.GotTick(tape[i]);
                if (i == 1)
                {
                    blt.AddInterval(120);
                }
            }

            //make sure we got one symbol as bar events
            Assert.Equal(1, syms.Count);

            // make sure our symbols matched barlist count
            Assert.Equal(blt.SymbolCount, syms.Count);

            // make sure same on individual bars
            Assert.True(blt[120].Count > 0);
        }
Example #2
0
        public void IntervalRequestDuringRun()
        {
            OHLCBarStream blt = new OHLCBarStream(new ForexSecurity("TST"));

            blt.AddInterval(BarInterval.FiveMin);
            blt.GotNewBar += new SymBarIntervalDelegate(blt_GotNewBar);

            Tick[] tape = TestBarList.SampleData();
            blt.Initialize();

            // add ticks from tape to tracker
            for (int i = 0; i < tape.Length; i++)
            {
                blt.GotTick(tape[i]);
                var value = blt[BarInterval.Minute].RecentBar;
            }

            // Check if the data differs per interval
            Assert.NotEqual(blt[BarInterval.Minute][-2].Close, blt[BarInterval.FiveMin][-2].Close);
        }