private void simulator_NewObject(SeriesObjectEventArgs args)
 {
     while (this.entryQueue.Count > 0)
     {
         OrderEntry orderEntry = this.entryQueue[0];
         if (!(orderEntry.DateTime <= args.Object.DateTime))
         {
             break;
         }
         this.entryQueue.RemoveAt(0);
         this.EmitNewOrderSingle(orderEntry);
     }
 }
Example #2
0
        private void OnNewObject(SeriesObjectEventArgs args)
        {
            Instrument instrument = this.seriesTable[args.Series] as Instrument;

            if (instrument == null)
            {
                instrument = InstrumentManager.Instruments[args.Series.Name.Substring(0, args.Series.Name.IndexOf('.'))];
            }
            IDataObject @object = args.Object;

            if (@object is Bar)
            {
                Bar bar = @object as Bar;
                if (bar.IsComplete)
                {
                    this.EmitNewBarEvent(instrument, bar);
                    if (bar.BarType == BarType.Time)
                    {
                        Dictionary <long, int> dictionary;
                        long size;
                        (dictionary = this.slices)[size = bar.Size] = dictionary[size] - 1;
                        if (this.slices[bar.Size] == 0)
                        {
                            this.EmitNewBarSlice(bar.Size);
                            return;
                        }
                    }
                }
                else
                {
                    this.EmitNewBarOpenEvent(instrument, bar);
                    if (bar.BarType == BarType.Time)
                    {
                        if (!this.slices.ContainsKey(bar.Size))
                        {
                            this.slices[bar.Size] = 0;
                        }
                        Dictionary <long, int> dictionary2;
                        long size2;
                        (dictionary2 = this.slices)[size2 = bar.Size] = dictionary2[size2] + 1;
                    }
                }
                return;
            }
            if (@object is Trade)
            {
                this.EmitNewTradeEvent(instrument, @object as Trade);
                return;
            }
            if (@object is Quote)
            {
                this.EmitNewQuoteEvent(instrument, @object as Quote);
                return;
            }
            if (@object is MarketDepth)
            {
                this.EmitNewMarketDepth(instrument, @object as MarketDepth);
                return;
            }
            if (@object is Fundamental)
            {
                this.EmitNewFundamental(instrument, @object as Fundamental);
                return;
            }
            if (@object is CorporateAction)
            {
                this.EmitNewCorporateAction(instrument, @object as CorporateAction);
            }
        }