public IStopLimitOrder TryGetStopLimitOrder(uint exchangeOrderId) { if (!StopLimitOrders.ContainsKey(exchangeOrderId)) { return(null); } return(StopLimitOrders[exchangeOrderId]); }
public IStopLimitOrder NewStopLimitOrder(string symbol, int clientId, double triggerPrice, double limitPrice, int quantity, WayEnum way) { if (!ClientStopLimitOrders.ContainsKey(clientId)) { ClientStopLimitOrders.Add(clientId, new EditableList <IStopLimitOrder>()); } var trigger = new BestPriceTrigger(symbol, triggerPrice, way); var toReturn = new StopLimitOrder(symbol, quantity, limitPrice, triggerPrice, way, clientId, trigger); toReturn.SetExchangeOrderId(globalItemCounter); StopLimitOrders.Add(globalItemCounter, toReturn); ClientStopLimitOrders[clientId].Add(toReturn); toReturn.RegisterOrderRepositoryDeleteHandler(HandleDeletedStopLimitOrder); globalItemCounter++; return(toReturn); }
private void HandleDeletedStopLimitOrder(IStopLimitOrder stopLimitOrder) { stopLimitOrder.UnRegisterOrderRepositoryDeleteHandler(); StopLimitOrders.Remove(stopLimitOrder.ExchangeOrderId); ClientStopLimitOrders[stopLimitOrder.ClientId].Remove(stopLimitOrder); }