Exemplo n.º 1
0
        public void QuoteOnlyTest()
        {
            TickImpl[] timesales = new TickImpl[] {
                TickImpl.NewBid("TST",100m,100),
                TickImpl.NewAsk("TST",100.1m,200),
            };

            Blade b = new Blade();
            BarListImpl bl = new BarListImpl(BarInterval.FiveMin,"TST");

            foreach (TickImpl k in timesales)
            {
                bl.newTick(k);
                b.newBar(bl);
            }

            // average volume should be zero bc
            // with only quotes we should have no bars to process
            Assert.That(b.AvgVol(bl) == 0, b.AvgVol(bl).ToString());
            Assert.That(!bl.Has(1), bl.ToString());
        }
Exemplo n.º 2
0
 public void PointHour()
 {
     // get data
     Tick[] tape = SampleData();
     // count new hour bars
     newbars = 0;
     // setup hour bar barlist
     BarListImpl bl = new BarListImpl(BarInterval.Hour, sym);
     // handle new bar events
     bl.GotNewBar += new SymBarIntervalDelegate(bl_GotNewBar);
     // add ticks to bar
     foreach (Tick k in tape)
     {
         // add ticks
         bl.newPoint(k.trade,k.time,k.date,k.size);
     }
     // make sure we have at least 1 bars
     Assert.IsTrue(bl.Has(1));
     // make sure we actually have two bars
     Assert.AreEqual(2, bl.Count);
 }