Example #1
0
		public bool AddReplaceItem(MarketDepth item)
		{
			bool flag = false;
			int num = 0;
			IEnumerator enumerator = this.fList.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					MarketDepth marketDepth = (MarketDepth)enumerator.Current;
					if (marketDepth.Price == item.Price && marketDepth.Size == item.Size && marketDepth.MarketMaker == item.MarketMaker && marketDepth.Side == item.Side)
					{
						this.fList[num] = item;
						flag = true;
					}
					num++;
				}
			}
			finally
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			if (!flag)
			{
				this.fList.Add(item);
			}
			return flag;
		}
Example #2
0
 public void EmitMarketDepth(FreeQuant.Data.MarketDepth depth, Instrument instrument)
 {
     if (this.WiB4iTUE4w == null)
     {
         return;
     }
     this.WiB4iTUE4w((object)this, new MarketDepthEventArgs(depth, (IFIXInstrument)instrument, (IMarketDataProvider)this));
 }
Example #3
0
 public void Add(MarketDepth marketDepth)
 {
     DataManager.Add(this, marketDepth);
 }
Example #4
0
 public void Add(string series, MarketDepth marketDepth)
 {
     DataManager.Add(this, series, marketDepth);
 }
Example #5
0
 public MarketDepth(MarketDepth marketDepth) : this(marketDepth.DateTime, marketDepth.ProviderId, marketDepth.MarketMaker, marketDepth.Source, marketDepth.Position, marketDepth.operation, marketDepth.side, marketDepth.Price, marketDepth.Size)
 {
 }
Example #6
0
 public static void Add(Instrument instrument, string suffix, MarketDepth marketDepth)
 {
     DataManager.Add(instrument.Symbol + SERIES_SEPARATOR + suffix, marketDepth);
 }
Example #7
0
    internal void NEl89GHdA(Instrument obj0, MarketDepth obj1)
    {
      if (!this.isActive)
        return;
      if (Trace.IsLevelEnabled(TraceLevel.Verbose))
				Trace.WriteLine(string.Format("fds", (object) this.Name, (object) obj0.Symbol, (object) obj1));
      this.OnNewMarketDepth(obj0, obj1);
    }
Example #8
0
		public void Add(MarketDepth marketDepth)
		{
			try
			{
				OrderBookEntryList orderBookEntryList;
				switch (marketDepth.Side)
				{
					case MDSide.Bid:
						orderBookEntryList = this.bidList;
						break;
					case MDSide.Ask:
						orderBookEntryList = this.askList;
						break;
					default:
						throw new ArgumentException("Invalid Side" + marketDepth.Side);
				}

				switch (marketDepth.Operation)
				{
					case MDOperation.Insert:
						if (marketDepth.Position == -1)
						{
							int index = -1;
							switch (marketDepth.Side)
							{
								case MDSide.Bid:
									index = 0;
									while (index < orderBookEntryList.Count && marketDepth.Price <= orderBookEntryList[index].Price)
										++index;
									break;
								case MDSide.Ask:
									index = orderBookEntryList.Count;
									while (index > 0 && marketDepth.Price <= orderBookEntryList[index - 1].Price)
										--index;
									break;
							}
							orderBookEntryList.Insert(index, new OrderBookEntry(marketDepth.DateTime, marketDepth.Price, marketDepth.Size));
							this.EmitChanged(marketDepth.Side, marketDepth.Operation, index);
							break;
						}
						else
						{
							orderBookEntryList.Insert(marketDepth.Position, new OrderBookEntry(marketDepth.DateTime, marketDepth.Price, marketDepth.Size));
							this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
							break;
						}
					case MDOperation.Update:
						if (marketDepth.Position == -1 || marketDepth.Position >= orderBookEntryList.Count)
							break;
						OrderBookEntry orderBookEntry = orderBookEntryList[marketDepth.Position];
						orderBookEntry.DateTime = marketDepth.DateTime;
						orderBookEntry.Size = marketDepth.Size;
						if (marketDepth.Price > 0.0)
							orderBookEntry.Price = marketDepth.Price;
						this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
						break;
					case MDOperation.Delete:
						if (marketDepth.Position == -1)
							break;
						orderBookEntryList.RemoveAt(marketDepth.Position);
						this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
						break;
					case MDOperation.Reset:
						orderBookEntryList.Clear();
						this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
						break;
					case MDOperation.Undefined:
						break;
					default:
                        throw new ArgumentException("MDOperation is unknown: " + marketDepth.Operation.ToString());
				}
			}
			catch (Exception ex)
			{
                Trace.WriteLine(ex.ToString());
			}
		}
		public HistoricalMarketDepthEventArgs(MarketDepth marketDepth, string requestId, IFIXInstrument instrument, IHistoricalDataProvider provider, int dataLength)
			: base(requestId, instrument, provider, dataLength)
		{
			this.MarketDepth = marketDepth;
		}
Example #10
0
 public void SetNewMarketDepth(FreeQuant.Instruments.Instrument instrument, MarketDepth depth)
 {
   try
   {
     Strategy strategy = (Strategy) null;
     if (!this.strategies.TryGetValue(instrument, out strategy))
       return;
     strategy.OnOrderBookChanged((OrderBookUpdate) this.objectConverter.Convert(depth));
   }
   catch (Exception ex)
   {
     this.EmitError(ex);
   }
 }
Example #11
0
		public MarketDepth(MarketDepth marketDepth) : this(marketDepth.DateTime, marketDepth.ProviderId, marketDepth.MarketMaker, marketDepth.Source, marketDepth.Position, marketDepth.operation, marketDepth.side, marketDepth.Price, marketDepth.Size)
		{
		}
Example #12
0
 protected override void OnNewMarketDepth(Instrument instrument, MarketDepth marketDepth)
 {
   this.kXJRQmVtwY.OnMarketDepth(instrument, marketDepth);
   this.k7bROYTXtn.OnMarketDepth(instrument, marketDepth);
 }
Example #13
0
        public void Add(MarketDepth marketDepth)
        {
            try
            {
                OrderBookEntryList orderBookEntryList;
                switch (marketDepth.Side)
                {
                case MDSide.Bid:
                    orderBookEntryList = this.bidList;
                    break;

                case MDSide.Ask:
                    orderBookEntryList = this.askList;
                    break;

                default:
                    throw new ArgumentException("Invalid Side" + marketDepth.Side);
                }

                switch (marketDepth.Operation)
                {
                case MDOperation.Insert:
                    if (marketDepth.Position == -1)
                    {
                        int index = -1;
                        switch (marketDepth.Side)
                        {
                        case MDSide.Bid:
                            index = 0;
                            while (index < orderBookEntryList.Count && marketDepth.Price <= orderBookEntryList[index].Price)
                            {
                                ++index;
                            }
                            break;

                        case MDSide.Ask:
                            index = orderBookEntryList.Count;
                            while (index > 0 && marketDepth.Price <= orderBookEntryList[index - 1].Price)
                            {
                                --index;
                            }
                            break;
                        }
                        orderBookEntryList.Insert(index, new OrderBookEntry(marketDepth.DateTime, marketDepth.Price, marketDepth.Size));
                        this.EmitChanged(marketDepth.Side, marketDepth.Operation, index);
                        break;
                    }
                    else
                    {
                        orderBookEntryList.Insert(marketDepth.Position, new OrderBookEntry(marketDepth.DateTime, marketDepth.Price, marketDepth.Size));
                        this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
                        break;
                    }

                case MDOperation.Update:
                    if (marketDepth.Position == -1 || marketDepth.Position >= orderBookEntryList.Count)
                    {
                        break;
                    }
                    OrderBookEntry orderBookEntry = orderBookEntryList[marketDepth.Position];
                    orderBookEntry.DateTime = marketDepth.DateTime;
                    orderBookEntry.Size     = marketDepth.Size;
                    if (marketDepth.Price > 0.0)
                    {
                        orderBookEntry.Price = marketDepth.Price;
                    }
                    this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
                    break;

                case MDOperation.Delete:
                    if (marketDepth.Position == -1)
                    {
                        break;
                    }
                    orderBookEntryList.RemoveAt(marketDepth.Position);
                    this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
                    break;

                case MDOperation.Reset:
                    orderBookEntryList.Clear();
                    this.EmitChanged(marketDepth.Side, marketDepth.Operation, marketDepth.Position);
                    break;

                case MDOperation.Undefined:
                    break;

                default:
                    throw new ArgumentException("MDOperation is unknown: " + marketDepth.Operation.ToString());
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
        }
Example #14
0
		public object Convert(MarketDepth marketDepth)
		{
			return new OrderBookUpdate(marketDepth);
		}
Example #15
0
 protected override void OnNewMarketDepth(Instrument instrument, MarketDepth marketDepth)
 {
   this.A6MpF2380O.OnMarketDepth(instrument, marketDepth);
   this.HeHpDewVKD.OnMarketDepth(instrument, marketDepth);
   this.marketManager.OnMarketDepth(instrument, marketDepth);
   this.exits[instrument].OnMarketDepth(marketDepth);
   this.entries[instrument].OnMarketDepth(marketDepth);
   this.moneyManagers[instrument].OnMarketDepth(marketDepth);
   this.riskManagers[instrument].OnMarketDepth(marketDepth);
 }
Example #16
0
		public virtual void OnMarketDepth(MarketDepth marketDepth)
		{
		}
Example #17
0
		public virtual void OnMarketDepth(Instrument instrument, MarketDepth marketDepth)
		{
		}
Example #18
0
		protected override void OnNewMarketDepth(Instrument instrument, MarketDepth marketDepth)
		{
			this.marketManager.OnMarketDepth(instrument, marketDepth);
			this.klBiFcxZsD.OnMarketDepth(instrument, marketDepth);
			this.csNiLdTRqH[instrument].OnMarketDepth(marketDepth);
		}
Example #19
0
		private void HiaeqOcUjh(IFIXInstrument instrument, MarketDepth md)
		{
			if (this.NewMarketDepth != null)
			{
				this.NewMarketDepth(this, new MarketDepthEventArgs(md, instrument, this));
			}
		}
Example #20
0
 protected virtual void OnNewMarketDepth(Instrument instrument, MarketDepth marketDepth)
 {
 }
Example #21
0
 internal OrderBookUpdate(MarketDepth marketDepth)
 {
   this.marketDepth = marketDepth;
 }
Example #22
0
 public static void Add(string series, MarketDepth marketDepth)
 {
     DataManager.server.Add(series, marketDepth);
 }
Example #23
0
		public MarketDepthEventArgs(MarketDepth marketDepth, IFIXInstrument instrument, IMarketDataProvider provider) : base(instrument, provider)
		{
			this.MarketDepth = marketDepth;
		}
Example #24
0
 public static void Add(Instrument instrument, MarketDepth marketDepth)
 {
     DataManager.Add(instrument, SUFFIX_MARKET_DEPTH, marketDepth);
 }
Example #25
0
 public void EmitMarketDepth(Instrument instrument, DateTime time, BidAsk side, OrderBookAction action, double price, int size, int position)
 {
   MarketDepth marketDepth = new MarketDepth(time, string.Empty, position, EnumConverter.Convert(action), EnumConverter.Convert(side), price, size);
   if (this.NewMarketDepth == null)
     return;
   this.NewMarketDepth((object) this, new MarketDepthEventArgs(marketDepth, (IFIXInstrument) instrument.instrument, (IMarketDataProvider) this));
 }