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); }
public string Proceed() { int startDate; if (updateFillUp) { startDate = codeInfo.Start; } else { int lastTradingDay = klineDataStore.GetLastTradingDay(codeInfo.Code, period); startDate = this.tradingDayReader.GetNextTradingDay(lastTradingDay); } int endDate = this.tradingDayReader.LastTradingDay; IKLineData klineData = historyData.GetKLineData(codeInfo.Code, startDate, endDate, period); if (klineData == null || klineData.Length == 0) { return(""); } if (updateFillUp) { klineDataStore.Delete(codeInfo.Code, period); } klineDataStore.Append(codeInfo.Code, period, klineData); if (updatedDataInfo != null) { int realEndDate = (int)klineData.Arr_Time[klineData.Length - 1]; updatedDataInfo.WriteUpdateInfo_KLine(codeInfo.Code, period, realEndDate); updateInfoStore.Save(updatedDataInfo); } return(StepDesc + "完毕"); }