Exemple #1
0
        private void AddTrade(IFIXInstrument instrument, DateTime datetime, double price, int size)
        {
            foreach (BarFactoryItem barFactoryItem in this.Items)
            {
                if (barFactoryItem.Enabled)
                {
                    Dictionary <BarType, SortedList <long, OfflineBarFactory.BarSizeCounter> > dictionary;
                    if (!this.ReSeeRRAl.TryGetValue(instrument, out dictionary))
                    {
                        dictionary = new Dictionary <BarType, SortedList <long, OfflineBarFactory.BarSizeCounter> >();
                        this.ReSeeRRAl.Add(instrument, dictionary);
                    }
                    SortedList <long, OfflineBarFactory.BarSizeCounter> sortedList;
                    if (!dictionary.TryGetValue(barFactoryItem.BarType, out sortedList))
                    {
                        sortedList = new SortedList <long, OfflineBarFactory.BarSizeCounter>();
                        dictionary.Add(barFactoryItem.BarType, sortedList);
                    }
                    OfflineBarFactory.BarSizeCounter gcuMn6TqoRuEfhwr;
                    if (!sortedList.TryGetValue(barFactoryItem.BarSize, out gcuMn6TqoRuEfhwr))
                    {
                        gcuMn6TqoRuEfhwr = new OfflineBarFactory.BarSizeCounter();
                        sortedList.Add(barFactoryItem.BarSize, gcuMn6TqoRuEfhwr);
                    }
                    switch (barFactoryItem.BarType)
                    {
                    case BarType.Time:
                        if (gcuMn6TqoRuEfhwr.bar == null || gcuMn6TqoRuEfhwr.bar.EndTime <= datetime)
                        {
                            if (gcuMn6TqoRuEfhwr.bar != null)
                            {
                                this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
                            }
                            DateTime dateTime1;
                            DateTime dateTime2;
                            this.iYlXRwvKS(datetime, barFactoryItem.BarSize, out dateTime1, out dateTime2);
                            gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Time, barFactoryItem.BarSize, dateTime1, dateTime2, price);
                        }
                        this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
                        continue;

                    case BarType.Tick:
                        if (gcuMn6TqoRuEfhwr.bar == null)
                        {
                            gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Tick, barFactoryItem.BarSize, datetime, datetime, price);
                        }
                        this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
                        gcuMn6TqoRuEfhwr.bar.EndTime = datetime;
                        if ((long)++gcuMn6TqoRuEfhwr.counter == barFactoryItem.BarSize)
                        {
                            this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
                            gcuMn6TqoRuEfhwr.bar     = null;
                            gcuMn6TqoRuEfhwr.counter = 0;
                            continue;
                        }
                        else
                        {
                            continue;
                        }

                    case BarType.Volume:
                        if (gcuMn6TqoRuEfhwr.bar == null)
                        {
                            gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Volume, barFactoryItem.BarSize, datetime, datetime, price);
                        }
                        this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
                        gcuMn6TqoRuEfhwr.bar.EndTime = datetime;
                        if (gcuMn6TqoRuEfhwr.bar.Volume >= barFactoryItem.BarSize)
                        {
                            this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
                            gcuMn6TqoRuEfhwr.bar = null;
                            continue;
                        }
                        else
                        {
                            continue;
                        }

                    default:
                        continue;
                    }
                }
            }
        }
Exemple #2
0
		private void AddTrade(IFIXInstrument instrument, DateTime datetime, double price, int size)
		{
			foreach (BarFactoryItem barFactoryItem in this.Items)
			{
				if (barFactoryItem.Enabled)
				{
					Dictionary<BarType, SortedList<long, OfflineBarFactory.BarSizeCounter>> dictionary;
					if (!this.ReSeeRRAl.TryGetValue(instrument, out dictionary))
					{
						dictionary = new Dictionary<BarType, SortedList<long, OfflineBarFactory.BarSizeCounter>>();
						this.ReSeeRRAl.Add(instrument, dictionary);
					}
					SortedList<long, OfflineBarFactory.BarSizeCounter> sortedList;
					if (!dictionary.TryGetValue(barFactoryItem.BarType, out sortedList))
					{
						sortedList = new SortedList<long, OfflineBarFactory.BarSizeCounter>();
						dictionary.Add(barFactoryItem.BarType, sortedList);
					}
					OfflineBarFactory.BarSizeCounter gcuMn6TqoRuEfhwr;
					if (!sortedList.TryGetValue(barFactoryItem.BarSize, out gcuMn6TqoRuEfhwr))
					{
						gcuMn6TqoRuEfhwr = new OfflineBarFactory.BarSizeCounter();
						sortedList.Add(barFactoryItem.BarSize, gcuMn6TqoRuEfhwr);
					}
					switch (barFactoryItem.BarType)
					{
						case BarType.Time:
							if (gcuMn6TqoRuEfhwr.bar == null || gcuMn6TqoRuEfhwr.bar.EndTime <= datetime)
							{
								if (gcuMn6TqoRuEfhwr.bar != null)
									this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
								DateTime dateTime1;
								DateTime dateTime2;
								this.iYlXRwvKS(datetime, barFactoryItem.BarSize, out dateTime1, out dateTime2);
								gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Time, barFactoryItem.BarSize, dateTime1, dateTime2, price);
							}
							this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
							continue;
						case BarType.Tick:
							if (gcuMn6TqoRuEfhwr.bar == null)
								gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Tick, barFactoryItem.BarSize, datetime, datetime, price);
							this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
							gcuMn6TqoRuEfhwr.bar.EndTime = datetime;
							if ((long)++gcuMn6TqoRuEfhwr.counter == barFactoryItem.BarSize)
							{
								this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
								gcuMn6TqoRuEfhwr.bar = null;
								gcuMn6TqoRuEfhwr.counter = 0;
								continue;
							}
							else
								continue;
						case BarType.Volume:
							if (gcuMn6TqoRuEfhwr.bar == null)
								gcuMn6TqoRuEfhwr.bar = this.ssgZj9bjo(BarType.Volume, barFactoryItem.BarSize, datetime, datetime, price);
							this.jtf8pUBX1(gcuMn6TqoRuEfhwr.bar, price, size);
							gcuMn6TqoRuEfhwr.bar.EndTime = datetime;
							if (gcuMn6TqoRuEfhwr.bar.Volume >= barFactoryItem.BarSize)
							{
								this.M28GqE2S2(instrument, gcuMn6TqoRuEfhwr.bar);
								gcuMn6TqoRuEfhwr.bar = null;
								continue;
							}
							else
								continue;
						default:
							continue;
					}
				}
			}
		}