示例#1
0
        public void Run(List<Model> models)
        {
            string action = _generate ? "Generating" : "Testing";
            foreach (var test in _dates)
            {
                List<string> mktdataFiles = new List<string>();
                mktdataFiles.Add(string.Format("..\\..\\..\\DBImporter\\MktData\\mktdata_{0}_{1}_{2}.csv", test.Day, test.Month, test.Year));
                Config.Settings["REPLAY_CSV"] = Config.TestList(mktdataFiles);
                Config.Settings["EXPECTEDRESULTS_CSV"] = string.Format("..\\..\\expected_results\\{3}_{0}_{1}_{2}.csv", test.Day, test.Month, test.Year, _testName);
                Config.Settings["RUSH_START_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 13/* - 5*/, 30, 0);
                Config.Settings["RUSH_STOP_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 15/* - 5*/, 30, 0);
                if (_fullday)
                {
                    Config.Settings["PUBLISHING_START_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 6, 0, 0);
                    Config.Settings["PUBLISHING_STOP_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 22, 45, 0);
                    Config.Settings["TRADING_START_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 8, 0, 0);
                    Config.Settings["TRADING_STOP_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 21, 15, 0);
                    Config.Settings["TRADING_CLOSING_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 20, 45, 0);
                    Config.Settings["TIMESERIES_MAX_RECORD_TIME_HOURS"] = "12";
                }
                else
                {
                    Config.Settings["PUBLISHING_START_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 14, 30, 0);
                    Config.Settings["PUBLISHING_STOP_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 16, 15, 0);
                    Config.Settings["TRADING_START_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 14, 30, 0);
                    Config.Settings["TRADING_STOP_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 16, 10, 0);
                    Config.Settings["TRADING_CLOSING_TIME"] = string.Format("{0}-{1}-{2} {3}:{4}:{5}", test.Year, test.Month, test.Day, 16, 5, 0);
                    Config.Settings["TIMESERIES_MAX_RECORD_TIME_HOURS"] = "2";
                }

                if (_generate)
                {
                    if (!_publish_to_db)
                        Config.Settings["PUBLISHING_CSV"] = string.Format("..\\..\\expected_results\\{3}gen_{0}_{1}_{2}.csv", test.Day, test.Month, test.Year, _testName);
                }

                Console.WriteLine(string.Format("{0} the {1} daily record {2}-{3}-{4}...", action, _testName, test.Year, test.Month, test.Day));
                MarketDataConnection.Instance.Connect(null);
                _trader = new Trader(models, onShutdown);
                if (_generate)
                {
                    _trader.Start();
                    _trader.Stop();
                }
                else
                {
                    _trader.Init(GetNow);
                    _stopEvent = new AutoResetEvent(false);
                    _stopEvent.WaitOne();
                }
            }
        }
示例#2
0
 public MidaxIceI(Trader trader, string name)
 {
     _serverName = name;
     _trader = trader;
 }