/// <summary> /// Full Constructor /// </summary> /// <param name="tickerId">The ticker Id that was specified previously in the call to reqMktDepth().</param> /// <param name="position">Specifies the row Id of this market depth entry.</param> /// <param name="operation">Identifies how this order should be applied to the market depth.</param> /// <param name="side">Identifies the side of the book that this order belongs to.</param> /// <param name="price">The order price.</param> /// <param name="size">The order size.</param> public UpdateMarketDepthEventArgs(int tickerId, int position, MarketDepthOperation operation, MarketDepthSide side, decimal price, int size) { this.tickerId = tickerId; this.size = size; this.price = price; this.side = side; this.operation = operation; this.position = position; }
/// <summary> /// Full Constructor /// </summary> /// <param name="tickerId">The ticker Id that was specified previously in the call to <see cref="IBClient.RequestMarketDepth"/>.</param> /// <param name="position">Specifies the row id of this market depth entry.</param> /// <param name="marketMaker">Specifies the exchange hosting this order.</param> /// <param name="operation">Identifies the how this order should be applied to the market depth.</param> /// <param name="side">Identifies the side of the book that this order belongs to.</param> /// <param name="price">The order price.</param> /// <param name="size">The order size.</param> public UpdateMarketDepthL2EventArgs(int tickerId, int position, string marketMaker, MarketDepthOperation operation, MarketDepthSide side, double price, int size) { this.tickerId = tickerId; this.size = size; this.price = price; this.side = side; this.operation = operation; this.marketMaker = marketMaker; this.position = position; }
/// <summary> /// Raised when New Quote Prices are received /// </summary> private void OnUpdateMarketDepth(object sender, UpdateMarketDepthEventArgs eventArgs) { try { lock (_lock) { MarketDepthSide type = eventArgs.Side; if (type.Equals(MarketDepthSide.Ask)) { Tick tick = _tickList[eventArgs.TickerId]; _ask.Security.Symbol = tick.Security.Symbol; _ask.AskSize = eventArgs.Size; _ask.AskPrice = eventArgs.Price; _ask.DateTime = DateTime.Now; if (TickArrived != null) { TickArrived(_ask); } } else if (type.Equals(MarketDepthSide.Bid)) { Tick tick = _tickList[eventArgs.TickerId]; _bid.Security.Symbol = tick.Security.Symbol; _bid.BidSize = eventArgs.Size; _bid.BidPrice = eventArgs.Price; _bid.DateTime = DateTime.Now; if (TickArrived != null) { TickArrived(_bid); } } } } catch (Exception exception) { Logger.Error(exception, _type.FullName, "OnUpdateMarketDepth"); } }