public void Construction() { BarImpl b = new BarImpl(); Assert.True(!b.IsValid); Assert.True(!b.IsNew); b.NewTick(_ticklist[0]); Assert.True(b.IsValid); Assert.True(b.IsNew); b.NewTick(_ticklist[1]); Assert.True(b.IsValid); Assert.True(!b.IsNew); Assert.True(b.Volume == 200); b.NewTick(TickImpl.NewQuote(Sym, D, T, 10m, 11m, 1, 1, X, X)); Assert.True(b.TradeCount == 2); }
public void BarIntervals() { BarImpl b = new BarImpl(BarInterval.FiveMin); int accepts = _ticklist.Count(k => b.NewTick(k)); Assert.Equal(5, accepts); b = new BarImpl(BarInterval.FifteenMin); accepts = _ticklist.Count(k => b.NewTick(k)); Assert.Equal(9, accepts); b = new BarImpl(BarInterval.Minute); accepts = 0; for (int i = 7; i < _ticklist.Length; i++) { if (b.NewTick(_ticklist[i])) { accepts++; } } Assert.Equal(2, accepts); }