Пример #1
0
        public void GenerateData(string symbol, int lastWeek)
        {
            TestParameters.SaveCCScoresToDb = true;
            TestParameters2.RealTimeMode    = false;

            TestParameters.EnablePerhourTrain = false;
            TestParameters.BatchTrainMinutes  = 2 * 4 * 7 * 24 * 12 * 5;
            TestParameters.BatchTestMinutes   = (int)(1 * 1 * 3 * 5);
            TestParameters.BatchDateStart     = TestParameters2.TrainStartTime;
            TestParameters.BatchDateEnd       = TestParameters2.TrainEndTime;

            var ea = new TestManager();

            string fileName = string.Format("{0}\\console_{1}_ccScores_w{2}.txt", TestParameters.BaseDir,
                                            symbol, lastWeek);

            if (System.IO.File.Exists(fileName))
            {
                System.Console.WriteLine("File exist.");
                return;
            }
            string tableName    = string.Format("{0}_CCSCORE_{1}", symbol, lastWeek);
            bool   tableAlready = false;

            try
            {
                Feng.Data.DbHelper.Instance.ExecuteDataTable("SELECT TOP 1 * FROM " + tableName);
                tableAlready = true;
            }
            catch (Exception)
            {
            }
            if (tableAlready)
            {
                System.Console.WriteLine("table exist");
                return;
            }

            ea.BatchBatch(symbol, lastWeek);
            //System.IO.File.Move(string.Format("{0}\\console.txt", TestParameters.BaseDir), fileName);
            System.IO.File.Delete(string.Format("{0}\\console.txt", TestParameters.BaseDir));

            DbData.Instance.Clear();
        }