示例#1
0
文件: Bar.cs 项目: antonywu/tradelink
 public Bar(Bar b)
 {
     h = b.High;
     l = b.Low;
     o = b.Open;
     c = b.Close;
     DAYEND = b.DAYEND;
     bartime = b.bartime;
     bardate = b.bardate;
 }
示例#2
0
        public void Construction()
        {
            Bar b = new Bar();
            Assert.That(!b.isValid);
            Assert.That(!b.isNew);
            b.newTick(ticklist[0]);
            Assert.That(b.isValid);
            Assert.That(b.isNew);
            b.newTick(ticklist[1]);
            Assert.That(b.isValid);
            Assert.That(!b.isNew);
            Assert.That(b.Volume == 200);
            b.newTick(Tick.NewQuote(sym,d,t,0,10m,11m,1,1,x,x));
            Assert.That(b.TradeCount == 2);


        }
示例#3
0
        public void BarIntervals()
        {


            Bar b = new Bar(BarInterval.FiveMin);
            int accepts = 0;
            foreach (Tick k in ticklist)
                if (b.newTick(k)) accepts++;
            Assert.That(accepts == 5);

            b = new Bar(BarInterval.FifteenMin);
            accepts = 0;
            foreach (Tick k in ticklist)
                if (b.newTick(k)) accepts++;
            Assert.That(accepts == 9);

            b = new Bar(BarInterval.Minute);
            accepts = 0;
            for (int i = 7; i<ticklist.Length; i++)
                if (b.newTick(ticklist[i])) accepts++;
            Assert.That(accepts == 2);

        }
示例#4
0
 public static int[] Date(Bar bar) { return Date(bar.Bardate); }