示例#1
0
        public void BarPerformance()
        {
            MultiSimImpl h = new MultiSimImpl(Environment.CurrentDirectory);
            h.GotTick += new TradeLink.API.TickDelegate(h_GotTick);

            h.Initialize();

            tickcount = 0;
            lasttime = 0;

            Assert.AreEqual(0, lasttime);
            Assert.Greater(h.TicksPresent, 0);
            if (Environment.ProcessorCount == 1) EXPECTBARS *= 2.5;

            DateTime start = DateTime.Now;

            h.PlayTo(MultiSimImpl.ENDSIM);

            double time = DateTime.Now.Subtract(start).TotalSeconds;
            h.Stop();
            Assert.GreaterOrEqual(tickcount, 50000);
            Assert.AreEqual(3, bt.SymbolCount);
            Assert.LessOrEqual(time, EXPECTBARS);
            rt.d("BarList runtime: " + time.ToString("N2") + "sec, versus: " + EXPECTBARS + "sec expected.");
            rt.d("BarList " + ((double)tickcount / time).ToString("N0") + " ticks/sec");
        }
示例#2
0
        public void ExecutionPerformance()
        {
            System.Threading.Thread.Sleep(100);
            h = new MultiSimImpl(Environment.CurrentDirectory);
            h.Initialize();
            h.GotTick += new TradeLink.API.TickDelegate(execute_GotTick);
            SimBroker.GotFill += new TradeLink.API.FillDelegate(SimBroker_GotFill);

            tickcount = 0;
            lasttime = 0;

            Assert.AreEqual(0, tickcount);
            Assert.AreEqual(0, syms.Count);
            Assert.AreEqual(0, lasttime);
            Assert.Greater(h.TicksPresent, 0);
            if (Environment.ProcessorCount == 1) EXPECTEX *= 2.5;

            DateTime start = DateTime.Now;

            h.PlayTo(MultiSimImpl.ENDSIM);

            double time = DateTime.Now.Subtract(start).TotalSeconds;

            rt.d("Execution runtime: " + time.ToString("N2") + "sec, versus: " + EXPECTEX + "sec expected.");
            rt.d("Execution " + ((double)tickcount / time).ToString("N0") + " ticks/sec.  " + ((double)fillcount / time).ToString("N0") + " fills/sec");

            Assert.AreEqual(desiredfills, fillcount);
            Assert.LessOrEqual(time, EXPECTEX);
            h.Stop();
        }