private void DepthFilteredClick(object sender, RoutedEventArgs e) { var connector = Connector; if (!_initialized) { connector.MarketDepthReceived += TraderOnMarketDepthReceived; _initialized = true; } foreach (var security in SecurityPicker.SelectedSecurities) { // create order book window var window = new QuotesWindow { Title = security.Id + " " + LocalizedStrings.MarketDepth, Security = security, }; //window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security)); window.Show(); // subscribe on order book flow var subscription = connector.SubscribeFilteredMarketDepth(security); _quotesWindowsBySubscription.Add(subscription, window); window.Closed += (s, e) => { if (_appClosing) { return; } if (subscription.State.IsActive()) { connector.UnSubscribe(subscription); } }; } }
private void SubscribeDepths(DepthSettings settings) { var connector = Connector; if (!_initialized) { connector.MarketDepthReceived += TraderOnMarketDepthReceived; _initialized = true; } foreach (var security in SecurityPicker.SelectedSecurities) { // create order book window var window = new QuotesWindow { Title = security.Id + " " + LocalizedStrings.MarketDepth, Security = security, }; //window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security)); window.Show(); // subscribe on order book flow var subscription = connector.SubscribeMarketDepth(security, settings?.From, settings?.To, buildMode: settings?.BuildMode ?? MarketDataBuildModes.LoadAndBuild, maxDepth: settings?.MaxDepth, buildFrom: settings?.BuildFrom); _quotesWindows.SafeAdd(security).Add(window); window.Closed += (s, e) => { if (_appClosing) { return; } if (subscription.State.IsActive()) { connector.UnSubscribe(subscription); } }; } }
private void DepthClick(object sender, RoutedEventArgs e) { var connector = Connector; foreach (var security in SecurityPicker.SelectedSecurities) { var window = _quotesWindows.SafeAdd(security, s => { // subscribe on order book flow connector.SubscribeMarketDepth(security); // create order book window var wnd = new QuotesWindow { Title = security.Id + " " + LocalizedStrings.MarketDepth }; wnd.MakeHideable(); return(wnd); }); if (window.Visibility == Visibility.Visible) { window.Hide(); } else { window.Show(); window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security)); } if (!_initialized) { connector.MarketDepthChanged += TraderOnMarketDepthChanged; _initialized = true; } } }