private void SessionOnStil2Update(ref structSTIL2Update structL2Update) { var depth = _depths[structL2Update.bstrSymbol]; var quote = new QuoteChange(structL2Update.bstrSide.ToSide(), (decimal)structL2Update.fPrice, structL2Update.nQty); var quotes = quote.Side == Sides.Sell ? depth.Item1 : depth.Item2; switch (structL2Update.bstrAction) { case "A": // add { quotes.Add(quote); break; } case "C": // change { quotes.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); quotes.Add(quote); break; } case "D": // delete { quotes.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } var board = structL2Update.bstrMaker; if (board.IsEmpty()) { board = AssociatedBoardCode; } var message = new QuoteChangeMessage { SecurityId = new SecurityId { SecurityCode = structL2Update.bstrSymbol, BoardCode = board, }, Asks = depth.Item1.ToArray(), Bids = depth.Item2.ToArray(), ServerTime = structL2Update.bstrTime.StrToTime(), }; SendOutMessage(message); }
private void SessionOnStil2Update(ref structSTIL2Update structL2Update) { var asksUpdate = _depths[structL2Update.bstrSymbol].Item1; var bidsUpdate = _depths[structL2Update.bstrSymbol].Item2; var quote = new QuoteChange(structL2Update.bstrSide.ToSide(), (decimal)structL2Update.fPrice, structL2Update.nQty) { BoardCode = structL2Update.bstrMaker }; switch (structL2Update.bstrSide.ToSide()) { case Sides.Buy: { switch (structL2Update.bstrAction) { case "A": // add { bidsUpdate.Add(quote); break; } case "C": // change { bidsUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); bidsUpdate.Add(quote); break; } case "D": // delete { bidsUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } break; } case Sides.Sell: { switch (structL2Update.bstrAction) { case "A": // add { asksUpdate.Add(quote); break; } case "C": // change { asksUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); asksUpdate.Add(quote); break; } case "D": // delete { asksUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } break; } } var message = new QuoteChangeMessage { SecurityId = new SecurityId { SecurityCode = structL2Update.bstrSymbol, BoardCode = "All", }, Asks = asksUpdate, Bids = bidsUpdate, ServerTime = structL2Update.bstrTime.StrToTime(), }; SendOutMessage(message); }
private void SessionOnStil2Update(ref structSTIL2Update structL2Update) { var depth = _depths[structL2Update.bstrSymbol]; var quote = new QuoteChange(structL2Update.bstrSide.ToSide(), (decimal)structL2Update.fPrice, structL2Update.nQty); var quotes = quote.Side == Sides.Sell ? depth.Item1 : depth.Item2; switch (structL2Update.bstrAction) { case "A": // add { quotes.Add(quote); break; } case "C": // change { quotes.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); quotes.Add(quote); break; } case "D": // delete { quotes.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } var board = structL2Update.bstrMaker; if (board.IsEmpty()) board = AssociatedBoardCode; var message = new QuoteChangeMessage { SecurityId = new SecurityId { SecurityCode = structL2Update.bstrSymbol, BoardCode = board, }, Asks = depth.Item1.ToArray(), Bids = depth.Item2.ToArray(), ServerTime = structL2Update.bstrTime.StrToTime(), }; SendOutMessage(message); }
private void SessionOnStil2Update(ref structSTIL2Update structL2Update) { var asksUpdate = _depths[structL2Update.bstrSymbol].Item1; var bidsUpdate = _depths[structL2Update.bstrSymbol].Item2; var quote = new QuoteChange(structL2Update.bstrSide.ToSide(), (decimal) structL2Update.fPrice, structL2Update.nQty) {BoardCode = structL2Update.bstrMaker}; switch (structL2Update.bstrSide.ToSide()) { case Sides.Buy: { switch (structL2Update.bstrAction) { case "A": // add { bidsUpdate.Add(quote); break; } case "C": // change { bidsUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); bidsUpdate.Add(quote); break; } case "D": // delete { bidsUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } break; } case Sides.Sell: { switch (structL2Update.bstrAction) { case "A": // add { asksUpdate.Add(quote); break; } case "C": // change { asksUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); asksUpdate.Add(quote); break; } case "D": // delete { asksUpdate.RemoveWhere(q => q.Price == quote.Price && q.BoardCode == quote.BoardCode); break; } } break; } } var message = new QuoteChangeMessage { SecurityId = new SecurityId { SecurityCode = structL2Update.bstrSymbol, BoardCode = "All", }, Asks = asksUpdate, Bids = bidsUpdate, ServerTime = structL2Update.bstrTime.StrToTime(), }; SendOutMessage(message); }