void client_LimitOrderAccepted(object sender, LimitOrderDto e) { UiDispatcher.Dispatcher.Invoke(() => { LimitOrders.Add(new LimitOrderViewModel(e, client)); }); }
void client_LimitOrderSnapshot(object sender, System.Collections.Generic.List <LimitOrderDto> e) { UiDispatcher.Dispatcher.Invoke(() => { LimitOrders.Clear(); foreach (var limitOrderViewModel in LimitOrders) { LimitOrders.Remove(limitOrderViewModel); limitOrderViewModel.Dispose(); } foreach (var limitOrder in e) { LimitOrders.Add(new LimitOrderViewModel(limitOrder, client)); } }); }
public ILimitOrder NewLimitOrder(string symbol, int clientId, double price, int quantity, WayEnum way) { if (!ClientOrders.ContainsKey(clientId)) { ClientOrders.Add(clientId, new EditableList <ILimitOrder>()); } ILimitOrder toReturn = new LimitOrder(symbol, quantity, price, way, clientId); toReturn.SetExchangeOrderId(globalItemCounter); LimitOrders.Add(toReturn.ExchangeOrderId, toReturn); ClientOrders[clientId].Add(toReturn); toReturn.RegisterDeleteNotificationHandler(HandleDeletedLimitOrder); toReturn.RegisterFilledNotification(HandleDeletedLimitOrder); globalItemCounter++; return(toReturn); }