示例#1
0
文件: DataUpdate.cs 项目: wanwei/sc2
        private void UpdateTick(UpdateInfo_Tick generate_Tick)
        {
            String     code      = generate_Tick.code;
            List <int> openDates = generate_Tick.dates;

            for (int i = 0; i < openDates.Count; i++)
            {
                if (IsCancel)
                {
                    return;
                }
                int date = openDates[i];
                update_Tick.DoUpdate(code, openDates[i]);

                int nextIndex = i + 1;
                if (nextIndex >= openDates.Count)
                {
                    return;
                }

                if ((nextIndex) % PROGRESS_PERIOD == 0)
                {
                    if (AfterGeneratedPeriod != null)
                    {
                        UpdatedPeriodArgs args = new UpdatedPeriodArgs();
                        args.nextStartDate = date;
                        int endIndex = i + PROGRESS_PERIOD;
                        endIndex         = endIndex >= openDates.Count ? openDates.Count - 1 : endIndex;
                        args.nextEndDate = openDates[endIndex];
                        args.code        = generate_Tick.code;
                        args.Description = "正在生成tick数据:" + args.nextStartDate + "-" + args.nextEndDate;
                        AfterGeneratedPeriod(args);
                    }
                }
            }
        }