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); } }; } }
public DepthSettingsWindow() { InitializeComponent(); Settings = new DepthSettings(); }