Example #1
0
 private string Proceed_Overwrite()
 {
     for (int i = 0; i < dates.Count; i++)
     {
         int date = dates[i];
         KLineDataLastEndInfo  lastEndInfo    = GetLastEndInfo(date);
         Step_KLineData_OneDay step_klineData = new Step_KLineData_OneDay(dataUpdateHelper, codeInfo, date, KLinePeriod.KLinePeriod_1Minute, lastEndInfo.lastEndPrice, lastEndInfo.lastEndHold, true);
         step_klineData.Proceed();
     }
     return("更新完毕" + GetDesc());
 }
Example #2
0
        public string Proceed()
        {
            if (overwrite)
            {
                return(Proceed_Overwrite());
            }
            ITradingDayReader    openDateReader = this.dataUpdateHelper.GetAllTradingDayReader();
            KLineDataLastEndInfo lastEndInfo;
            IKLineData           lastKLineData = null;

            //string path = dataUpdateHelper.GetPath_KLineData(code, date, klinePeriod);
            for (int i = 0; i < dates.Count; i++)
            {
                int date = dates[i];
                if (i == 0)
                {
                    lastEndInfo = GetLastEndInfo(date);
                }
                else
                {
                    if (openDateReader.GetTradingDayIndex(date) - openDateReader.GetTradingDayIndex(dates[i - 1]) == 1)
                    {
                        if (lastKLineData != null)
                        {
                            lastEndInfo.lastEndPrice = lastKLineData.Arr_End[lastKLineData.Length - 1];
                            lastEndInfo.lastEndHold  = lastKLineData.Arr_Hold[lastKLineData.Length - 1];
                        }
                        else
                        {
                            lastEndInfo = GetLastEndInfo(date);
                        }
                    }
                    else
                    {
                        lastEndInfo = GetLastEndInfo(date);
                    }
                }
                Step_KLineData_OneDay step_klineData = new Step_KLineData_OneDay(dataUpdateHelper, codeInfo, date, KLinePeriod.KLinePeriod_1Minute, lastEndInfo.lastEndPrice, lastEndInfo.lastEndHold);
                step_klineData.Proceed();
                if (step_klineData.KlineData != null)
                {
                    lastKLineData = step_klineData.KlineData;
                }
            }
            if (!updateFillUp && updatedDataInfo != null)
            {
                updatedDataInfo.WriteUpdateInfo_KLine(codeInfo.Code, KLinePeriod.KLinePeriod_1Minute, dates[dates.Count - 1]);
                updatedDataInfo.Save();
            }
            return("更新完毕" + GetDesc());
        }
Example #3
0
        private List <IStep> GetAllStep_UpdateAppoint()
        {
            List <IStep> steps = new List <IStep>();

            //更新一次所有开盘时间
            //List<CodeInfo> allCodes = dataUpdateHelper.GetAllCodes();
            //GetTradingTime(steps, allCodes, true);

            List <AppointUpdate> aps = dataProvider.GetAppointUpdate();

            for (int i = 0; i < aps.Count; i++)
            {
                AppointUpdate ap       = aps[i];
                string        code     = ap.Code;
                int           date     = ap.Date;
                CodeInfo      codeInfo = dataUpdateHelper.GetCodeInfo(code);
                if (ap.UpdateTick)
                {
                    Step_TickData_CodeDate step = new Step_TickData_CodeDate(dataUpdateHelper, codeInfo, date, true);
                    steps.Add(step);
                }
                if (ap.UpdateKLine)
                {
                    //int prevDate = dataUpdateHelper.GetNewTradingDayCache().GetPrevTradingDay(date);
                    //ITickData newTickData = dataUpdateHelper.GetNewTickData(code, prevDate);
                    //if (newTickData == null) {
                    //    continue;
                    //}
                    //float lastEndPrice = newTickData.Arr_Price[newTickData.Length - 1];
                    //int lastEndHold = newTickData.Arr_Hold[newTickData.Length - 1];
                    float lastEndPrice         = -1;
                    int   lastEndHold          = -1;
                    Step_KLineData_OneDay step = new Step_KLineData_OneDay(dataUpdateHelper, codeInfo, ap.Date, KLinePeriod.KLinePeriod_1Minute, lastEndPrice, lastEndHold, true);
                    steps.Add(step);
                }
            }
            return(steps);
        }