Esempio n. 1
0
        public string Proceed()
        {
            string path = dataUpdateHelper.GetPath_KLineData(codeInfo.Code, date, klinePeriod);
            //if (!(codeInfo.Code.EndsWith("0000") || codeInfo.Code.EndsWith("MI")))
            //if (!overwrite && File.Exists(path))
            //    return codeInfo.Code + "-" + date + "的K线数据已存在";

            TickData tickData = (TickData)dataUpdateHelper.GetUpdatedTickData(codeInfo.Code, date);

            if (tickData == null)
            {
                tickData = (TickData)dataUpdateHelper.GetNewTickData(codeInfo.ServerCode, date);
            }
            //tick数据没有,则不生成对应K线数据
            if (tickData == null)
            {
                string msg = codeInfo.Code + "-" + date + "的tick数据不存在";
                LogHelper.Warn(GetType(), msg);
                return(msg);
            }

            IList <double[]> tradingPeriod = dataUpdateHelper.GetTradingTime(codeInfo.Code, date).TradingPeriods;

            //List<double[]> klineTimes = TradingTimeUtils.GetKLineTimeList_Full(tradingPeriod, KLinePeriod.KLinePeriod_1Minute);
            //timeListGetter.GetKLineTimeList(code, date, klinePeriod);
            this.klineData = DataTransfer_Tick2KLine.Transfer(tickData, tradingPeriod, KLinePeriod.KLinePeriod_1Minute, lastEndPrice, lastEndHold);
            CsvUtils_KLineData.Save(path, klineData);
            return("更新" + codeInfo.Code + "-" + date + "的" + klinePeriod + "K线完成");
        }
Esempio n. 2
0
 private void Delete(string code, List <int> dates)
 {
     for (int i = 0; i < dates.Count; i++)
     {
         int    date = dates[i];
         string path = dataUpdateHelper.GetPath_KLineData(code, date, KLinePeriod.KLinePeriod_1Minute);
         if (File.Exists(path))
         {
             File.Delete(path);
         }
     }
 }