public void AddStopOrder(Order order) { order.Sequnce = ++_sequence; if (order.IsBuy) { PriceLevel priceLevel = GetPriceLevel(order.StopPrice, _stopBid); priceLevel.AddOrder(order); if (_bestStopBidPriceLevel == null || order.StopPrice < _bestStopBidPriceLevel.Price) { _bestStopBidPriceLevel = priceLevel; } } else { PriceLevel priceLevel = GetPriceLevel(order.StopPrice, _stopAsk); priceLevel.AddOrder(order); if (_bestStopAskPriceLevel == null || order.StopPrice > _bestStopAskPriceLevel.Price) { _bestStopAskPriceLevel = priceLevel; } } }
public void AddStopOrder(Order order, Price stopPrice) { order.Sequnce = ++_sequence; _stopDictionary.Add(order.OrderId, stopPrice); if (order.IsBuy) { PriceLevel priceLevel = GetPriceLevel(stopPrice, _stopBid); priceLevel.AddOrder(order); if (_bestStopBidPriceLevel == null || stopPrice < _bestStopBidPriceLevel.Price) { _bestStopBidPriceLevel = priceLevel; } } else { PriceLevel priceLevel = GetPriceLevel(stopPrice, _stopAsk); priceLevel.AddOrder(order); if (_bestStopAskPriceLevel == null || stopPrice > _bestStopAskPriceLevel.Price) { _bestStopAskPriceLevel = priceLevel; } } }