Пример #1
0
 public void Go()
 {
     SimBroker.Reset();
     if (responseengine != null)
     {
         responseengine.Reset();
     }
     if (myhistsim != null)
     {
         myhistsim.Reset();
         myhistsim.PlayTo(MultiSimImpl.ENDSIM);
     }
     else
     {
         debug("No simulation defined on gauntlet engine.");
     }
 }
Пример #2
0
        public void RawPerformance()
        {
            HistSim h = new HistSim(Environment.CurrentDirectory+"\\");
            h.Initialize();
            h.GotTick += new TradeLink.API.TickDelegate(raw_GotTick);

            tickcount = 0;
            syms.Clear();
            lasttime = 0;

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

            DateTime start = DateTime.Now;

            h.PlayTo(HistSim.ENDSIM);
            

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

            // make sure ticks arrived in order
            Assert.IsTrue(GOODTIME,"Tick arrived out-of-order.");
            // check running time
            Assert.LessOrEqual(time, EXPECTRAW,"may fail on slow machines");
            Assert.AreEqual(3,syms.Count);
            // tick count is = 42610 (FTI) + 5001 (SPX) + 8041 (ABN)
            Assert.AreEqual(42610 + 4991 + 8041, tickcount);
            // variance from approximate count should be less than 1%
            Assert.Less((tickcount - h.TicksPresent) / h.TicksPresent, .01);
            // actual count should equal simulation count
            Assert.AreEqual(h.TicksProcessed, tickcount);
            // last time is 1649 on SPX
            Assert.AreEqual(20080318155843, lasttime);
            // printout simulation runtime
            Console.WriteLine("Raw runtime: " + time.ToString("N2") + "sec, versus: " + EXPECTRAW + "sec expected.");
            Console.WriteLine("Raw speed: " + ((double)tickcount / time).ToString("N0") + " ticks/sec");
        }
Пример #3
0
        public void BarPerformance()
        {
            HistSim h = new HistSim(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(HistSim.ENDSIM);

            double time = DateTime.Now.Subtract(start).TotalSeconds;
            Assert.GreaterOrEqual(tickcount, 50000);
            Assert.AreEqual(3, bt.SymbolCount);
            Assert.LessOrEqual(time, EXPECTBARS);
            Console.WriteLine("BarList runtime: " + time.ToString("N2") + "sec, versus: " + EXPECTBARS + "sec expected.");
            Console.WriteLine("BarList " + ((double)tickcount / time).ToString("N0") + " ticks/sec");
        }
Пример #4
0
 // runs the simulation in background
 void bw_DoWork(object sender, DoWorkEventArgs e)
 {
     // get simulation arguments
     GauntArgs ga = (GauntArgs)e.Argument;
     // notify user
     debug("Run started: " + ga.Name);
     // prepare simulator
     h = new HistSim(ga.Folder,ga.Filter);
     h.GotDebug += new DebugDelegate(h_GotDebug);
     h.GotTick += new TickDelegate(h_GotTick);
     // start simulation
     h.PlayTo(ga.PlayTo);
     // end simulation
     ga.Stopped = DateTime.Now;
     ga.TicksProcessed = h.TicksProcessed;
     ga.Executions = h.FillCount;
     // save result
     e.Result = ga;
 }
Пример #5
0
 public void Go()
 {
     _h.PlayTo(HistSim.ENDSIM);
 }