Esempio n. 1
0
        protected override void OnStart(string[] args)
        {
            myTimer       = new BANG.Common.Timer.MyThreadTimer(1000);
            myTimerSIGNAL = new BANG.Common.Timer.MyThreadTimer(1000);

            gStockCodeList = new List <string>();

            dbConnString = GetDbConnStr();
            ExeSecond    = GetExeSecond();
            StockGroup   = GetStockGroup();
            SimType      = GetSimType();

            flog = new BANG.Common.Log.FileLog("SimulService" + StockGroup, "C:\\Log", BANG.Common.Log.LogFileInteval.DAILY);
            flog.write(LogType.INFORMATION, "Simulator 시작");

            SqlDal sd = new SqlDal(dbConnString);

            //gStockCodeList = sd.GetStockCode("GROUP");
            gStockCodeList = sd.GetStockCode(StockGroup);

            isHoliday = sd.isHoliday();

            EventLog.WriteEntry("SimulatorSVC", "종목수 : " + gStockCodeList.Count.ToString() + Environment.NewLine + string.Format("{0} , {1} , {2}", SimType, ExeSecond, StockGroup));
            flog.write(LogType.INFORMATION, "종목수 : " + gStockCodeList.Count.ToString() + Environment.NewLine + string.Format("{0} , {1} , {2}", SimType, ExeSecond, StockGroup));

            INSERTTODAYTRADESUMMARY = sd.GetConfigValue("TRADER", "INSERTTODAYTRADESUMMARY");

            if (SimType == "ALL" || SimType == "SIGNAL")
            {
                myTimerSIGNAL.OnTick += myTimerSIGNAL_OnTick;
                myTimerSIGNAL.Start();
            }

            if (SimType == "ALL" || SimType == "DATA")
            {
                myTimer.OnTick += myTimer_OnTick;
                myTimer.Start();
            }
        }