Ejemplo n.º 1
0
 public void Run()
 {
     if (this.beginTime < Clock.Now)
     {
         this.beginTime = Clock.Now;
     }
     Clock.AddReminder(this.runOnce, this.beginTime, null);
 }
Ejemplo n.º 2
0
 private void AddReminder(DateTime datetime)
 {
     if (!this.times.Contains(datetime) && datetime >= Clock.Now)
     {
         Clock.AddReminder(new ReminderEventHandler(this.OnReminder), datetime, null);
         this.times.Add(datetime);
     }
 }
Ejemplo n.º 3
0
 private void nxZL6NXVXL(DateTime datetime)
 {
     if (!this.NJNLAPvWPO.Contains(datetime))
     {
         Clock.AddReminder(new ReminderEventHandler(this.nAMLprxZKC), datetime, null);
         this.NJNLAPvWPO.Add(datetime, null);
     }
 }
Ejemplo n.º 4
0
        public void AddInstrument(Instrument instrument)
        {
            float price = (float)instrument.Price();

            this.items.Add(instrument, new PoolItem(Clock.Now, price));
            if (this.autoLeave)
            {
                Clock.AddReminder(this.InstrumentOutPool, Clock.Now.Add(this.LeaveTime), instrument);
            }
        }
 public void SendOrderCancelRequest(OrderCancelRequest request)
 {
     if (this.Latency == 0)
     {
         this.E3jPCDq9jY(request);
     }
     else
     {
         Clock.AddReminder(new ReminderEventHandler(this.t99PErAC3Y), DateTime.Now.AddMilliseconds(this.Latency), request);
     }
 }
 public void SendOrderCancelReplaceRequest(OrderCancelReplaceRequest request)
 {
     if (this.Latency == 0)
     {
         this.M9IPlabLYo(request);
     }
     else
     {
         Clock.AddReminder(new ReminderEventHandler(this.gFqPLKYI6J), DateTime.Now.AddMilliseconds(this.Latency), request);
     }
 }
Ejemplo n.º 7
0
 public PortfolioStop(StrategyBase strategy, DateTime time, bool stopStrategy)
 {
     this.strategy       = strategy;
     this.portfolio      = strategy.Portfolio;
     this.stopStrategy   = stopStrategy;
     this.type           = StopType.Time;
     this.creationTime   = Clock.Now;
     this.completionTime = time;
     this.stopValue      = this.portfolio.GetValue();
     if (this.completionTime > this.creationTime)
     {
         Clock.AddReminder(new ReminderEventHandler(this.OnClock), this.completionTime, null);
     }
 }
Ejemplo n.º 8
0
 public Stop(StrategyBase strategy, Position position, DateTime time)
 {
     this.fStrategy       = strategy;
     this.fPosition       = position;
     this.fInstrument     = position.Instrument;
     this.fQty            = position.Qty;
     this.fSide           = position.Side;
     this.fType           = StopType.Time;
     this.fCreationTime   = Clock.Now;
     this.fCompletionTime = time;
     this.fStopPrice      = this.fInstrument.Price();
     if (this.fCompletionTime > this.fCreationTime)
     {
         Clock.AddReminder(new ReminderEventHandler(this.OnClock), this.fCompletionTime, null);
         this.fStrategy.AddStop(this);
     }
 }
Ejemplo n.º 9
0
 public Stop(StrategyBase strategy, Position position, DateTime time) : base()
 {
     this.Udd6EeE9v6      = strategy;
     this.fPosition       = position;
     this.fInstrument     = position.Instrument;
     this.fQty            = position.Qty;
     this.fSide           = position.Side;
     this.fType           = StopType.Time;
     this.fCreationTime   = Clock.Now;
     this.fCompletionTime = time;
     this.fStopPrice      = this.fInstrument.Price();
     if (!(this.fCompletionTime > this.fCreationTime))
     {
         return;
     }
     Clock.AddReminder(new ReminderEventHandler(this.mSa6vRBe3Z), this.fCompletionTime, (object)null);
     this.Udd6EeE9v6.AddStop((StopBase)this);
 }
Ejemplo n.º 10
0
 public PortfolioStop(StrategyBase strategy, DateTime time, bool stopStrategy)
     : base()
 {
     this.dUqRtBdT71 = StopType.Trailing;
     this.Wa9RdDJEOa = StopMode.Percent;
     this.rfci6isjj5 = StopFillMode.Stop;
     this.sKmRoRmeN5 = strategy;
     this.ElNRan0isi = strategy.Portfolio;
     this.RUQiAxBBaC = stopStrategy;
     this.dUqRtBdT71 = StopType.Time;
     this.XoERmcoQ62 = Clock.Now;
     this.xTNRf1TvWo = time;
     this.FuNRz16ilo = this.ElNRan0isi.GetValue();
     if (!(this.xTNRf1TvWo > this.XoERmcoQ62))
     {
         return;
     }
     Clock.AddReminder(new ReminderEventHandler(this.AaPRYK2epA), this.xTNRf1TvWo, (object)null);
 }
Ejemplo n.º 11
0
 public ATSStop(Position position, DateTime time)
 {
     this.fPosition       = position;
     this.fInstrument     = position.Instrument;
     this.fQty            = position.Qty;
     this.fSide           = position.Side;
     this.fType           = StopType.Time;
     this.fCreationTime   = Clock.Now;
     this.fCompletionTime = time;
     this.fStopPrice      = this.fInstrument.Price();
     this.series          = new DoubleSeries();
     if (this.fType == StopType.Trailing)
     {
         this.series.Add(this.fCreationTime, this.GetStopPrice());
     }
     if (this.fCompletionTime > this.fCreationTime)
     {
         Clock.AddReminder(new ReminderEventHandler(this.OnClock), this.fCompletionTime, null);
     }
 }
Ejemplo n.º 12
0
 public JobSchedule(JobQueue jobs, DateTime startTime, int maxTimes, TimeSpan interval, AutoResetEvent autoEvent)
 {
     this.jobs            = jobs;
     this.startTime       = startTime;
     this.maxTimes        = maxTimes;
     this.interval        = interval;
     this.autoEvent       = autoEvent;
     this.jobEventHandler = new ReminderEventHandler(this.doJobs);
     if (this.startTime > Clock.Now)
     {
         Clock.AddReminder(this.jobEventHandler, startTime, null);
     }
     else
     {
         Console.WriteLine("作业开始时间必须大于当前时间!");
         if (this.autoEvent != null)
         {
             this.autoEvent.Set();                                  //在不能开启作业的情况下,释放一次信号量
         }
     }
 }
Ejemplo n.º 13
0
 public ATSStop(Position position, DateTime time) : base()
 {
     this.fPosition       = position;
     this.fInstrument     = position.Instrument;
     this.fQty            = position.Qty;
     this.fSide           = position.Side;
     this.fType           = StopType.Time;
     this.fCreationTime   = Clock.Now;
     this.fCompletionTime = time;
     this.fStopPrice      = this.fInstrument.Price();
     this.series          = new DoubleSeries();
     if (this.fType == StopType.Trailing)
     {
         this.series.Add(this.fCreationTime, this.lkZijZtYnj());
     }
     if (!(this.fCompletionTime > this.fCreationTime))
     {
         return;
     }
     Clock.AddReminder(new ReminderEventHandler(this.tQYi7Nff5A), this.fCompletionTime, (object)null);
 }
 public void SendNewOrderSingle(NewOrderSingle order)
 {
     if (this.IsConnected)
     {
         if (this.Latency == 0)
         {
             this.lCXP6mCfhb(order);
         }
         else
         {
             Clock.AddReminder(new ReminderEventHandler(this.MxtPRD9hCH), DateTime.Now.AddMilliseconds(this.Latency), order);
         }
     }
     else
     {
         ExecutionReport report = new ExecutionReport();
         report.TransactTime     = DateTime.Now;
         report.ClOrdID          = order.ClOrdID;
         report.ExecType         = ExecType.Rejected;
         report.OrdStatus        = OrdStatus.Rejected;
         report.Symbol           = order.Symbol;
         report.SecurityType     = order.SecurityType;
         report.SecurityExchange = order.SecurityExchange;
         report.Currency         = order.Currency;
         report.Side             = order.Side;
         report.OrdType          = order.OrdType;
         report.TimeInForce      = order.TimeInForce;
         report.OrderQty         = order.OrderQty;
         report.Price            = order.Price;
         report.StopPx           = order.StopPx;
         report.LastPx           = 0.0;
         report.LastQty          = 0.0;
         report.AvgPx            = 0.0;
         report.CumQty           = 0.0;
         report.LeavesQty        = order.OrderQty;
         report.Text             = "text";
         this.JPVPJSWclF(report);
     }
 }
Ejemplo n.º 15
0
 private void doJobs(ReminderEventArgs args)
 {
     if (this.jobs != null)
     {
         this.jobThread = new Thread(new ThreadStart(this.jobs.Run));
         this.jobThread.Start();
         this.jobThread.Join();
         if (this.jobThread.ThreadState == ThreadState.Aborted || this.closed)
         {
             if (this.autoEvent != null)
             {
                 this.autoEvent.Set();
             }
             Console.WriteLine("作业被中断执行。");
             return;
         }
         //如果没有完成且小于偿试的次数,N分钟后继续启动
         if ((!this.jobs.Finished) && (this.jobs.Times < maxTimes))
         {
             Clock.AddReminder(this.jobEventHandler, Clock.Now.Add(interval), null);
         }
         else
         {
             if (this.autoEvent != null)
             {
                 this.autoEvent.Set();
             }
             if (this.jobs.Finished)
             {
                 Console.WriteLine("所有作业执行完毕");
             }
             else if (this.jobs.Times >= maxTimes)
             {
                 Console.WriteLine("偿试多次后仍然无法完成。");
             }
         }
     }
 }
Ejemplo n.º 16
0
        private void dGEFgdOydF()
        {
            if (!(this.PYBF7sahqY is SingleOrder))
            {
                return;
            }
            SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder;

            if (singleOrder.ContainsField(11201))
            {
                this.kUyFaL3cQu = (FillOnBarMode)singleOrder.FillOnBarMode;
            }
            Instrument instrument = singleOrder.Instrument;
            bool       flag       = !singleOrder.IsStopLimitReady && (singleOrder.OrdType == OrdType.TrailingStop || singleOrder.OrdType == OrdType.TrailingStopLimit || singleOrder.OrdType == OrdType.StopLimit);

            if (singleOrder.OrdType == OrdType.Market)
            {
                if ((this.A8bFJItyyx.FillOnQuote && !flag || this.A8bFJItyyx.TriggerOnQuote && flag) && this.A8bFJItyyx.FillOnQuoteMode == FillOnQuoteMode.LastQuote)
                {
                    this.Y18FFPmDy5(instrument.Quote, (Trade)null, (Bar)null);
                }
                if ((this.A8bFJItyyx.FillOnTrade && !flag || this.A8bFJItyyx.TriggerOnTrade && flag) && this.A8bFJItyyx.FillOnTradeMode == FillOnTradeMode.LastTrade)
                {
                    this.Y18FFPmDy5((Quote)null, instrument.Trade, (Bar)null);
                }
                if ((this.A8bFJItyyx.FillOnBar && !flag || this.A8bFJItyyx.TriggerOnBar && flag) && ((this.kUyFaL3cQu == FillOnBarMode.LastBarClose || singleOrder.ForceMarketOrder) && this.A8bFJItyyx.BarFilter.Contains(instrument.Bar.BarType, instrument.Bar.Size)))
                {
                    this.Y18FFPmDy5((Quote)null, (Trade)null, instrument.Bar);
                }
            }
            else
            {
                if (instrument.Quote != null && (this.A8bFJItyyx.FillOnQuote && !flag || this.A8bFJItyyx.TriggerOnQuote && flag) && this.A8bFJItyyx.FillOnQuoteMode == FillOnQuoteMode.LastQuote)
                {
                    this.Y18FFPmDy5(instrument.Quote, (Trade)null, (Bar)null);
                }
                if (instrument.Trade != null && (this.A8bFJItyyx.FillOnTrade && !flag || this.A8bFJItyyx.TriggerOnTrade && flag) && this.A8bFJItyyx.FillOnTradeMode == FillOnTradeMode.LastTrade)
                {
                    this.Y18FFPmDy5((Quote)null, instrument.Trade, (Bar)null);
                }
                if (instrument.Bar != null && (this.A8bFJItyyx.FillOnBar && !flag || this.A8bFJItyyx.TriggerOnBar && flag) && (this.A8bFJItyyx.BarFilter.Contains(instrument.Bar.BarType, instrument.Bar.Size) && this.A8bFJItyyx.FillOnBarMode == FillOnBarMode.LastBarClose))
                {
                    double close = instrument.Bar.Close;
                    if (close != 0.0)
                    {
                        this.wYBFLwFB4S(close, singleOrder.OrderQty);
                    }
                }
            }
            if (this.aXtFGP76FH)
            {
                return;
            }
            if (this.A8bFJItyyx.FillOnQuote || this.A8bFJItyyx.TriggerOnQuote)
            {
                instrument.NewQuote += new QuoteEventHandler(this.PyJFklA8yp);
            }
            if (this.A8bFJItyyx.FillOnTrade || this.A8bFJItyyx.TriggerOnTrade)
            {
                instrument.NewTrade += new TradeEventHandler(this.YGKFrq1UXP);
            }
            this.smCF4MYTNu = instrument.Quote;
            if (this.A8bFJItyyx.FillOnBar || this.A8bFJItyyx.TriggerOnBar)
            {
                if (singleOrder.ForceMarketOrder)
                {
                    instrument.NewBar     += new BarEventHandler(this.YgkFRBfPV0);
                    instrument.NewBarOpen += new BarEventHandler(this.OyPFEsHGL2);
                }
                else if (singleOrder.OrdType == OrdType.Market)
                {
                    switch (this.kUyFaL3cQu)
                    {
                    case FillOnBarMode.LastBarClose:
                    case FillOnBarMode.NextBarClose:
                        instrument.NewBar += new BarEventHandler(this.YgkFRBfPV0);
                        break;

                    case FillOnBarMode.NextBarOpen:
                        instrument.NewBarOpen += new BarEventHandler(this.OyPFEsHGL2);
                        break;
                    }
                }
                else
                {
                    instrument.NewBar     += new BarEventHandler(this.YgkFRBfPV0);
                    instrument.NewBarOpen += new BarEventHandler(this.OyPFEsHGL2);
                }
            }
            if ((int)this.PYBF7sahqY.TimeInForce != 54)
            {
                return;
            }
            Clock.AddReminder(new ReminderEventHandler(this.xT1FyAqCPT), this.PYBF7sahqY.ExpireTime, (object)null);
        }
Ejemplo n.º 17
0
        private void Init()
        {
            if (this.fOrder is SingleOrder)
            {
                SingleOrder singleOrder = this.fOrder as SingleOrder;
                if (singleOrder.ContainsField(11201))
                {
                    this.fFillOnBarMode = (FillOnBarMode)singleOrder.FillOnBarMode;
                }
                Instrument instrument = singleOrder.Instrument;
                if (singleOrder.OrdType == OrdType.Market)
                {
                    if (this.fProvider.FillOnQuote && this.fProvider.FillOnQuoteMode == FillOnQuoteMode.LastQuote)
                    {
                        this.Process(instrument.Quote, null, null);
                    }
                    if (this.fProvider.FillOnTrade && this.fProvider.FillOnTradeMode == FillOnTradeMode.LastTrade)
                    {
                        this.Process(null, instrument.Trade, null);
                    }
                    if (this.fProvider.FillOnBar && (this.fFillOnBarMode == FillOnBarMode.LastBarClose || singleOrder.ForceMarketOrder) && this.fProvider.BarFilter.Contains(instrument.Bar.BarType, instrument.Bar.Size))
                    {
                        this.Process(null, null, instrument.Bar);
                    }
                }
                else
                {
                    if (instrument.Quote != null && this.fProvider.FillOnQuote)
                    {
                        this.Process(instrument.Quote, null, null);
                    }
                    if (instrument.Trade != null && this.fProvider.FillOnTrade)
                    {
                        this.Process(null, instrument.Trade, null);
                    }
                    if (instrument.Bar != null && this.fProvider.FillOnBar && this.fProvider.BarFilter.Contains(instrument.Bar.BarType, instrument.Bar.Size))
                    {
                        double close = instrument.Bar.Close;
                        if (close != 0.0)
                        {
                            this.StopLimit(close, singleOrder.OrderQty);
                        }
                    }
                }
                if (!this.fExecuted)
                {
                    if (this.fProvider.FillOnQuote)
                    {
                        instrument.NewQuote += new QuoteEventHandler(this.OnNewQuote);
                    }
                    if (this.fProvider.FillOnTrade)
                    {
                        instrument.NewTrade += new TradeEventHandler(this.OnNewTrade);
                    }
                    if (this.fProvider.FillOnBar)
                    {
                        if (singleOrder.ForceMarketOrder)
                        {
                            instrument.NewBar     += new BarEventHandler(this.OnNewBar);
                            instrument.NewBarOpen += new BarEventHandler(this.OnNewBarOpen);
                        }
                        else
                        {
                            if (singleOrder.OrdType == OrdType.Market)
                            {
                                switch (this.fFillOnBarMode)
                                {
                                case FillOnBarMode.LastBarClose:
                                case FillOnBarMode.NextBarClose:
                                    instrument.NewBar += new BarEventHandler(this.OnNewBar);
                                    break;

                                case FillOnBarMode.NextBarOpen:
                                    instrument.NewBarOpen += new BarEventHandler(this.OnNewBarOpen);
                                    break;
                                }
                            }
                            else
                            {
                                instrument.NewBar     += new BarEventHandler(this.OnNewBar);
                                instrument.NewBarOpen += new BarEventHandler(this.OnNewBarOpen);
                            }
                        }
                    }
                    if (this.fOrder.TimeInForce == '6')
                    {
                        Clock.AddReminder(new ReminderEventHandler(this.Clock_Reminder), this.fOrder.ExpireTime, null);
                    }
                }
            }
        }
Ejemplo n.º 18
0
        /*定时器执行更新报价*/
        private void tickTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            /*如果只在开市时读数据,在非开市时间直接退出*/
            if (onlyReadInMarket && (DateTime.Now < DateTime.Today.Add(beginTime) || DateTime.Now > DateTime.Today.Add(endTime)))
            {
                return;
            }
            /*当运行到第二天时,清空报价缓存*/
            if (lastDateOfQuote < DateTime.Today)
            {
                lastDateOfQuote = DateTime.Today;
                lastQuotes.Clear();
            }

            if (quoteReader == null)
            {
                quoteReader = new DZHQuoteReader(dzhDataPath);
            }
            try
            {
                foreach (string symbol in subscribedSymbols.ToArray())
                {
                    if (!subscribedSymbols.Contains(symbol))
                    {
                        continue;
                    }
                    Instrument curInstrument = InstrumentManager.Instruments[symbol];
                    if (curInstrument == null)
                    {
                        this.EmitError(-1, -1, "Symbol " + symbol + " was not found in list of requested symbols.");
                    }
                    else
                    {
                        DZHSymbol dzhSymbol = new DZHSymbol(curInstrument.SecurityExchange, curInstrument.SecurityID);
                        DZHQuote  newQuote  = quoteReader.RequestQuote(dzhSymbol);
                        bool      flag1     = false;
                        bool      flag2     = false;
                        bool      first     = false;//是否是请求的第一笔数据
                        if (this.lastQuotes.ContainsKey(symbol))
                        {
                            DZHQuote oldQuote = this.lastQuotes[symbol];

                            /*这里注释掉和下面一样,大智慧发送来的数据存在同一时刻多笔交易的现象
                             * 所以不能用时间来排除
                             */
                            //if (newQuote.Time != oldQuote.Time)
                            //{
                            if ((newQuote.Bid1 != oldQuote.Bid1) || (newQuote.Bid1Vol != oldQuote.Bid1Vol) ||

                                (newQuote.Ask1 != oldQuote.Ask1) || (newQuote.Ask1Vol != oldQuote.Ask1Vol))
                            {
                                flag1 = true;
                            }
                            if ((newQuote.TotalVolume != oldQuote.TotalVolume) || (newQuote.Price != oldQuote.Price))
                            {
                                flag2 = true;
                            }
                            // }
                            this.lastQuotes[symbol] = newQuote;
                        }
                        else
                        {
                            first = true;
                            if ((newQuote.Ask1 > 0.0) || (newQuote.Bid1 > 0.0))
                            {
                                flag1 = true;
                            }
                            if ((newQuote.Price > 0.0) || (newQuote.Volume > 0.0))
                            {
                                flag2 = true;
                            }
                            this.lastQuotes.Add(symbol, newQuote);
                        }

                        /*这里注释掉是,不做时间检查,因为不使用市场数据提供者存储数据,市场数据提供者只用于实时交易
                         *而要获取过去的数据存储起来,使用历史数据提供者
                         */
                        //if ((flag1) && ((curInstrument.GetQuoteArray(newQuote.Time, newQuote.Time)).Count == 0))
                        if (flag1)
                        {
                            this.EmitNewQuote(new Quote(newQuote.Time, newQuote.Bid1, (int)newQuote.Bid1Vol, newQuote.Ask1, (int)newQuote.Ask1Vol), curInstrument);
                        }

                        /*大智慧有可能在同一时刻有多笔交易,QD不允许这样,所以有可能丢失某些笔交易
                         * 如果不作同一时刻的检查,则有可能在数据中保存重复的交易
                         * 这里注释掉是,不做时间检查,因为不使用市场数据提供者存储数据,市场数据提供者只用于实时交易
                         *而要获取过去的数据存储起来,使用历史数据提供者
                         */
                        //if ((flag2) && ((curInstrument.GetTradeArray(newQuote.Time, newQuote.Time)).Count == 0))
                        if (flag2)
                        {
                            this.EmitNewTrade(new Trade(newQuote.Time, newQuote.Price, (int)newQuote.Volume), curInstrument);
                            /*以下代码是为了产生日线*/
                            if (first && buildDailyBar)
                            {
                                lock (this)
                                {
                                    DateTime barDateTime = newQuote.Time.Date;
                                    if (!dailyBars.ContainsKey(curInstrument))
                                    {
                                        dailyBars.Add(curInstrument, new Dictionary <DateTime, Daily>());
                                    }
                                    Dictionary <DateTime, Daily> dailyBox = dailyBars[curInstrument];
                                    if (!dailyBox.ContainsKey(barDateTime))
                                    {
                                        Daily daily = new Daily(barDateTime, newQuote.Open, newQuote.High, newQuote.Low, newQuote.Price, (long)newQuote.TotalVolume);
                                        dailyBox.Add(barDateTime, daily);
                                        ((DZHBarFactory)this.factory).EmitNewBarOpen(daily, curInstrument);
                                    }
                                    DateTime realyEndTime = Clock.Now.Add(this.endTime - newQuote.Time.TimeOfDay);
                                    Clock.AddReminder(new ReminderEventHandler(OnReminder), realyEndTime, null);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                this.EmitError(-1, -1, exception.ToString());
            }
        }
Ejemplo n.º 19
0
        protected virtual void runOnce(ReminderEventArgs args)
        {
            if (this.inPool != null && this.outPool != null)
            {
                if (this.ClearOutPoolFrist)
                {
                    this.outPool.Clear();
                }
                if (this.inPool.Count > 0)
                {
                    Dictionary <Instrument, float> sortDict = new Dictionary <Instrument, float>();

                    foreach (KeyValuePair <Instrument, PoolItem> item in this.inPool.GetItems())
                    {
                        if (this.outPool.ContainsInstrument(item.Key))
                        {
                            continue;                                           //输出池中已有
                        }
                        float ret = this.ConditionCode(item);
                        if (this.conditionType == 1)//条件模式
                        {
                            if (ret > 0)
                            {
                                this.outPool.AddInstrument(item.Key);
                                if (this.DeleteFromInPool)
                                {
                                    this.inPool.RemoveInstrument(item.Key);
                                }
                            }
                        }
                        else if (this.conditionType == 2)//排序模式
                        {
                            sortDict.Add(item.Key, ret);
                        }
                    }
                    if (this.conditionType == 2)//排序模式
                    {
                        List <Instrument> sortList;
                        if (this.sortByAsc)
                        {
                            sortList = (sortDict.OrderBy(o => o.Value)).Select(o => o.Key).ToList();
                        }
                        else
                        {
                            sortList = (sortDict.OrderByDescending(o => o.Value)).Select(o => o.Key).ToList();
                        }

                        for (int i = 0; i < this.RankLimit && i < sortList.Count; i++)
                        {
                            Instrument item = sortList[i];
                            this.outPool.AddInstrument(item);
                            if (this.DeleteFromInPool)
                            {
                                this.inPool.RemoveInstrument(item);
                            }
                        }
                    }
                }
                if (!this.justOnce)
                {
                    DateTime nextTime = Clock.Now.Add(this.interval);
                    if (nextTime <= this.beginTime.Add(this.keepTime))
                    {
                        Clock.AddReminder(this.runOnce, nextTime, null);
                    }
                }
            }
        }