Example #1
0
        protected override void GlobalProcess(ScheduleEventArgs args)
        {
            if (args.TimeType != Entity.Contants.Types.TradingTimeType.Open)
            {
                return;
            }
            try
            {
                //1.分红之前提交内存数据
                MemoryDataManager.End();

                StockOpenCloseProcess.DoMelonCutting();
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("现货分红处理异常", ex);
            }
            try
            {
                //重新加载一次
                MemoryDataManager.Start();
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("现货分红加载内存异常", ex);
            }
            //=============
        }
        private static void SetTrigger(DateTime triggerTime, Types.TradingTimeType timeType, string id)
        {
            DateTime now  = DateTime.Now;
            DateTime time = new DateTime(now.Year, now.Month, now.Day, triggerTime.Hour, triggerTime.Minute,
                                         triggerTime.Second);

            string expFormat = "{0} {1} {2} ? * *";
            string exp       = String.Format(expFormat, time.Second, time.Minute, time.Hour);

            ScheduleEventArgs args = new ScheduleEventArgs
            {
                //BourseTypeID = bourseType.BourseTypeID,
                TimeType = timeType,
                Time     = time
            };

            string newTriggerName = id + "trigger";
            string newGroupName   = id + "Group";

            CronTrigger trigger = new CronTrigger(newTriggerName, newGroupName, exp);

            trigger.JobDataMap.SetScheduleEventArgs(args);

            string    newJobName = id + "job";
            JobDetail job        = new JobDetail(newJobName, null, typeof(ScheduleJob));

            scheduler.ScheduleJob(job, trigger);

            string format = "ScheduleManager.SetTrigger[JobName={0},TiggerName={1},GroupName={2}]";
            string desc   = string.Format(format, newJobName, newTriggerName, newGroupName);

            //LogHelper.WriteDebug(desc + " Args=" + args);
            LogHelper.WriteDebug("ScheduleManager.SetTrigger" + args);
        }
 private static void DoNotify(ScheduleEventArgs args)
 {
     if (OnNotify != null)
     {
         LogHelper.WriteDebug("DoNotify" + args);
         OnNotify(args);
     }
 }
Example #4
0
        /// <summary>
        /// 关联到ScheduleManager的通知处理方法
        /// </summary>
        /// <param name="args"></param>
        public void DoNotify(ScheduleEventArgs args)
        {
            LogHelper.WriteDebug("---->MarketProcessJob.RecieveNotify" + args);
            this.processArgs = args;

            DoGlobalAction();

            if (this.doDetailLoop)
            {
                DoDetailLoopAction();
            }
        }
Example #5
0
 protected override void GlobalProcess(ScheduleEventArgs args)
 {
     if (args.TimeType != Entity.Contants.Types.TradingTimeType.MatchEndWork)
     {
         return;
     }
     //update 李健华 2009-12-15=====因为有关内存表的数据,所以在这里盘后清算时不作多线程操作
     //Thread futureCloseThread = new Thread(FutureOpenCloseProcess.DoClose);
     //futureCloseThread.Start();
     FutureOpenCloseProcess.DoClose();
     //=========
 }
Example #6
0
 protected override void GlobalProcess(ScheduleEventArgs args)
 {
     if (args.TimeType != Entity.Contants.Types.TradingTimeType.MacthBeginWork)
     {
         return;
     }
     try
     {
         StockOpenCloseProcess.DoOpen();
     }
     catch (Exception ex)
     {
         LogHelper.WriteError("现货开市处理异常", ex);
     }
 }
            /// <summary>
            /// 任务调度入口
            /// </summary>
            /// <param name="context">调度上下文</param>
            public void Execute(JobExecutionContext context)
            {
                ScheduleEventArgs args = context.Trigger.JobDataMap.GetScheduleEventArgs();

                if (args == null)
                {
                    args      = new ScheduleEventArgs();
                    args.Time = context.FireTimeUtc.Value.ToLocalTime();

                    LogHelper.WriteDebug(string.Format("ScheduleJob[args=null,Time={0}]", args.Time));
                }
                else
                {
                    LogHelper.WriteDebug(string.Format("ScheduleJob[TimeType={0},Time={1}]",
                                                       args.TimeType, args.Time));

                    //if (CheckTradeDate(args))
                    DoNotify(args);
                }
            }
 private static void SetScheduleEventArgs(this IDictionary dataMap, ScheduleEventArgs args)
 {
     dataMap[SCHEDULE_ARGS] = args;
 }
Example #9
0
 /// <summary>
 /// 每一个商品代码处理入口
 /// </summary>
 /// <param name="args">任务参数</param>
 /// <param name="commodity">商品</param>
 /// <param name="breedClassTypeEnum">品种类型名称 1.股票现货 2.商品期货 3.股指期货</param>
 protected abstract void DetailProcess(ScheduleEventArgs args, CM_Commodity commodity,
                                       Types.BreedClassTypeEnum breedClassTypeEnum);
Example #10
0
 protected override void DetailProcess(ScheduleEventArgs args, CM_Commodity commodity,
                                       Types.BreedClassTypeEnum breedClassTypeEnum)
 {
 }
Example #11
0
 /// <summary>
 /// 总处理入口
 /// </summary>
 protected abstract void GlobalProcess(ScheduleEventArgs args);