private JobQueue buildReconnectJobs() { JobQueue reconnectJobs = new JobQueue(); Job reconnectMartketJob = new ReconnectProviderJob("重连接市场数据提供者", this.MarketDataProvider); Job reconnectTradeJob = new ReconnectProviderJob("重连接交易提供者", this.ExecutionProvider); reconnectJobs.Add(reconnectMartketJob); reconnectJobs.Add(reconnectTradeJob); return(reconnectJobs); }
private JobQueue buildChangePositionJobs() { JobQueue changePositionJobs = new JobQueue(); Job sellBadestPositionJob = new SellBadestPositionJob("卖出最差持仓", this); Job buyGoodestPositionJob = new BuyGoodestPositionJob("买入最佳持仓", this); changePositionJobs.Add(sellBadestPositionJob); changePositionJobs.Add(buyGoodestPositionJob); return(changePositionJobs); }
//生成每日作业队列 private JobQueue buildDayJobs() { JobQueue jobs = new JobQueue(); DateTime curDate = Clock.Now.Date; //DateTime curDate=new DateTime(2017,12,5); Job checkInstruments = new CheckInstrumentsJob("检查证券定义"); Job saveDailys = new SaveDailysJob("下载Daily数据", curDate, new Job[] { checkInstruments }); jobs.Add(checkInstruments); jobs.Add(saveDailys); return(jobs); }
//生成每日作业队列 private JobQueue buildDayJobs(DateTime jobDate) { JobQueue jobs = new JobQueue(); Job checkInstruments = new CheckInstrumentsJob("检查证券定义"); Job saveDailys = new SaveDailysJob("下载Daily数据", jobDate, new Job[] { checkInstruments }); Job saveRandomTradeRecordsJob = new SaveRandomTradeRecordsJob("保存随机交易记录", jobDate, this, new Job[] { saveDailys }); Job dqnTrainJob = new DQNTrainJob("神经网络训练", jobDate, this.tradeDates, new Job[] { saveRandomTradeRecordsJob }); //Job dqnTrainJob=new DQNTrainJob("神经网络训练",jobDate,this.tradeDates); jobs.Add(checkInstruments); jobs.Add(saveDailys); jobs.Add(saveRandomTradeRecordsJob); jobs.Add(dqnTrainJob); return(jobs); }
public int Post(string message) { var jobId = _jobQueue.Add(message); _logger.LogInformation($"added job {jobId} to queue"); return(jobId); }
//生成每日作业队列 private JobQueue buildJobs() { JobQueue jobs = new JobQueue(); DateTime curDate = Clock.Now.Date; //DateTime curDate=new DateTime(2017,12,5); Job checkInstruments = new CheckInstrumentsJob("检查证券定义"); Job saveTicks = new SaveTicksJob("下载Tick数据", curDate, new Job[] { checkInstruments }); Job saveDailys = new SaveDailysJob("下载Daily数据", curDate, new Job[] { checkInstruments }); Job checkTicks = new CheckTicksJob("检查Tick数据", curDate, new Job[] { saveTicks, saveDailys }); Job buildUpLimits = new BuildUpLimitsJob("生成涨停数据表", curDate, new Job[] { checkTicks }); jobs.Add(checkInstruments); jobs.Add(saveTicks); jobs.Add(saveDailys); jobs.Add(checkTicks); jobs.Add(buildUpLimits); return(jobs); }
private void ActiveJobsCallBack(InvokeOperation <IEnumerable <JobBase> > io) { List <JobBase> activeJobArray = new List <JobBase>(); if (io.Value != null) { activeJobArray = new List <JobBase>(io.Value); } foreach (JobBase jobItem in activeJobArray) { if (jobItem.Code == monitoringJobCode) { UpdateCurrentJob(jobItem); } else { } var jobFound = JobQueue.FirstOrDefault(x => x.Code == jobItem.Code); if (jobFound != null) { //update job info UpdateExistingJob(jobFound, jobItem); } else { //insert job info JobQueue.Add(CloneJob(jobItem)); } } //Remove jobs from queue that don't exist in Array var c = from aItem in JobQueue from bItem in activeJobArray.Where(bItem => aItem.Code == bItem.Code).DefaultIfEmpty() where bItem == null select aItem; JobQueue.RemoveAll(x => c.Contains(x)); }
public void Sync_Requested(object sender = null, EventArgs e = null) { ManualForceCompare = false; if (sender != null && sender.GetType().ToString().EndsWith("Timer")) //Automated sync { Forms.Main.Instance.NotificationTray.UpdateItem("delayRemove", enabled: false); Timer aTimer = sender as Timer; Object timerProfile = null; if (aTimer.Tag.ToString() == "PushTimer" && aTimer is PushSyncTimer) { timerProfile = (aTimer as PushSyncTimer).owningProfile; } else if (aTimer.Tag.ToString() == "AutoSyncTimer" && aTimer is SyncTimer) { timerProfile = (aTimer as SyncTimer).owningProfile; } if (JobQueue.Add(new Job(aTimer.Tag.ToString(), timerProfile))) { aTimer.Stop(); } else { log.Warn("Sync of profile '" + Settings.Profile.Name(timerProfile) + "' requested by " + aTimer.Tag.ToString() + " already previously queued."); } } else //Manual sync { if (Forms.Main.Instance.bSyncNow.Text == "Start Sync" || Forms.Main.Instance.bSyncNow.Text == "Start Full Sync") { log.Info("Manual sync requested."); if (SyncingNow) { log.Info("Already busy syncing, cannot accept another sync request."); OgcsMessageBox.Show("A sync is already running. Please wait for it to complete and then try again.", "Sync already running", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (Control.ModifierKeys == Keys.Shift) { if (Forms.Main.Instance.ActiveCalendarProfile.SyncDirection == Direction.Bidirectional) { OgcsMessageBox.Show("Forcing a full sync is not allowed whilst in 2-way sync mode.\r\nPlease temporarily chose a direction to sync in first.", "2-way full sync not allowed", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } log.Info("Shift-click has forced a compare of all items"); ManualForceCompare = true; } this.ActiveProfile = Forms.Main.Instance.ActiveCalendarProfile; Start(manualIgnition: true, updateSyncSchedule: false); } else if (Forms.Main.Instance.bSyncNow.Text == "Stop Sync") { GoogleOgcs.Calendar.Instance.Authenticator.CancelTokenSource.Cancel(); if (!SyncingNow) { return; } if (!bwSync.CancellationPending) { Forms.Main.Instance.Console.Update("Sync cancellation requested.", Console.Markup.warning); bwSync.CancelAsync(); } else { Forms.Main.Instance.Console.Update("Repeated cancellation requested - forcefully aborting sync!", Console.Markup.warning); AbortSync(); } if (this.JobQueue.Count() > 0) { if (OgcsMessageBox.Show("There are " + this.JobQueue.Count() + " sync(s) still queued to run. Would you like to cancel these too?", "Clear queued syncs?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { log.Info("User requested clear down of sync queue."); this.JobQueue.Clear(); } } } } }