예제 #1
0
        public void TestSaveLoadUpdatedDataInfo()
        {
            string path = TestCaseManager.GetTestCasePath(GetType(), "path_updateinfo");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            UpdatedDataInfo updatedDataInfo = new UpdatedDataInfo(path);

            updatedDataInfo.WriteUpdateInfo_Tick(CODE1, 20140120);
            updatedDataInfo.WriteUpdateInfo_Tick(CODE2, 20140520);
            updatedDataInfo.WriteUpdateInfo_KLine(CODE1, KLinePeriod.KLinePeriod_1Minute, 20140121);
            updatedDataInfo.WriteUpdateInfo_KLine(CODE1, KLinePeriod.KLinePeriod_5Minute, 20140122);
            updatedDataInfo.WriteUpdateInfo_KLine(CODE1, KLinePeriod.KLinePeriod_15Minute, 20140123);
            updatedDataInfo.WriteUpdateInfo_KLine(CODE1, KLinePeriod.KLinePeriod_1Day, 20140124);
            updatedDataInfo.WriteUpdateInfo_KLine(CODE2, KLinePeriod.KLinePeriod_1Minute, 20140525);
            updatedDataInfo.Save();

            UpdatedDataInfo updatedDataInfo2 = new UpdatedDataInfo(path);

            Assert.AreEqual(20140120, updatedDataInfo2.GetLastUpdatedTickData(CODE1));
            Assert.AreEqual(20140520, updatedDataInfo2.GetLastUpdatedTickData(CODE2));

            Assert.AreEqual(20140121, updatedDataInfo2.GetLastUpdatedKLineData(CODE1, KLinePeriod.KLinePeriod_1Minute));
            Assert.AreEqual(20140122, updatedDataInfo2.GetLastUpdatedKLineData(CODE1, KLinePeriod.KLinePeriod_5Minute));
            Assert.AreEqual(20140123, updatedDataInfo2.GetLastUpdatedKLineData(CODE1, KLinePeriod.KLinePeriod_15Minute));
            Assert.AreEqual(20140124, updatedDataInfo2.GetLastUpdatedKLineData(CODE1, KLinePeriod.KLinePeriod_1Day));
            Assert.AreEqual(20140525, updatedDataInfo2.GetLastUpdatedKLineData(CODE2, KLinePeriod.KLinePeriod_1Minute));

            Directory.Delete(path, true);
        }
예제 #2
0
파일: StepPreparer.cs 프로젝트: wanwei/sc2
        public List <IStep> GetAllSteps()
        {
            List <IStep> steps = new List <IStep>();

            IUpdateInfoStore updateInfoStore = dataStore.CreateUpdateInfoStore();
            UpdatedDataInfo  updateDataInfo  = updateInfoStore.Load();

            Step_UpdateTradingDays step_UpdateTradingDays = new Step_UpdateTradingDays(historyData, dataStore);
            IList <int>            newTradingDays         = step_UpdateTradingDays.NewTradingDays;

            steps.Add(step_UpdateTradingDays);
            steps.Add(new Step_UpdateCode(historyData, dataStore));

            //确定是否保存每个品种的交易时间
            if (dataCenterConfig.StoredDataTypes.IsStoreTradingSession)
            {
                AddSteps_TradingSessions(steps);
            }
            //steps.AddRange(new StepGetter_UpdateKLineData_Vaieties(historyData, dataStore, dataCenterConfig.StoredDataTypes.StoreKLinePeriods).GetSteps());
            //确定是否保存tick数据
            // if (dataCenterConfig.StoredDataTypes.IsStoreTick)
            steps.AddRange(new StepGetter_UpdateTickData(historyData, dataStore, isFillUp, updateDataInfo, updateInfoStore, newTradingDays).GetSteps());
            //增加k线数据保存步骤
            steps.AddRange(new StepGetter_UpdateKLineData(historyData, dataStore, dataCenterConfig.StoredDataTypes.StoreKLinePeriods, isFillUp, updateDataInfo, updateInfoStore, newTradingDays).GetSteps());
            steps.Add(new Step_UpdateMainFutures(historyData, dataStore));
            return(steps);
        }
예제 #3
0
 public StepGetter_UpdateTickData(IPlugin_HistoryData historyData, IDataStore dataStore, bool isFillUp, UpdatedDataInfo updatedDataInfo, IUpdateInfoStore updateInfoStore, IList <int> newTradingDays)
 {
     this.historyData     = historyData;
     this.dataStore       = dataStore;
     this.isFillUp        = isFillUp;
     this.updatedDataInfo = updatedDataInfo;
     this.updateInfoStore = updateInfoStore;
     this.newTradingDays  = newTradingDays;
 }
예제 #4
0
 public StepGetter_UpdateKLineData(IPlugin_HistoryData historyData, IDataStore dataStore, List <KLinePeriod> updatePeriods, bool isFillUp, UpdatedDataInfo updatedDataInfo, IUpdateInfoStore updateInfoStore, IList <int> newTradingDays)
 {
     this.historyData     = historyData;
     this.klineDataStore  = dataStore.CreateKLineDataStore();
     this.updatePeriods   = updatePeriods;
     this.isFillUp        = isFillUp;
     this.updatedDataInfo = updatedDataInfo;
     this.updateInfoStore = updateInfoStore;
     this.newTradingDays  = newTradingDays;
 }
예제 #5
0
        //public Step_UpdateKLineData(string code, int startDate, int endDate, KLinePeriod period, IPlugin_HistoryData historyData, IKLineDataStore klineDataStore)
        //{
        //    this.code = code;

        //    this.period = period;
        //    this.historyData = historyData;
        //    this.klineDataStore = klineDataStore;
        //}

        public Step_UpdateKLineData(CodeInfo codeInfo, KLinePeriod period, ITradingDayReader tradingDayReader, IPlugin_HistoryData historyData, IKLineDataStore klineDataStore, UpdatedDataInfo updatedDataInfo, IUpdateInfoStore updateInfoStore, bool updateFillUp)
        {
            this.codeInfo         = codeInfo;
            this.tradingDayReader = tradingDayReader;
            this.period           = period;
            this.historyData      = historyData;
            this.klineDataStore   = klineDataStore;
            this.updatedDataInfo  = updatedDataInfo;
            this.updateInfoStore  = updateInfoStore;
            this.updateFillUp     = updateFillUp;
        }
예제 #6
0
 public Step_SaveUpdateInfo(UpdatedDataInfo updatedDataInfo)
 {
     this.updatedDataInfo = updatedDataInfo;
 }
예제 #7
0
 public Step_UpdateTickData(string code, List <int> tradingDays, IPlugin_HistoryData historyData, ITickDataStore tickDataStore, UpdatedDataInfo updatedDataInfo, IUpdateInfoStore updateInfoStore) : this(code, tradingDays, historyData, tickDataStore)
 {
     this.updatedDataInfo = updatedDataInfo;
     this.updateInfoStore = updateInfoStore;
 }