registersecurity. StockSharphttps://stocksharp.com/handlers/atom.ashx?category=tag&id=registersecurity&type=communityCopyright @ StockSharp Platform LLC 2010 - 20242024-03-29T02:31:36Zhttps://stocksharp.com/images/logo.pnghttps://stocksharp.com/topic/8767/Problems registering security for level 1 price updates2017-10-29T22:07:59Z2017-11-01T22:54:50ZJohan Kirstenhttps://stocksharp.com/users/99799/info@stocksharp.comI have a windows service that hosts a web api interface. The service connects to an interactive broker TWS. A call to the web api must register the security to receive level 1 price updates. The code to do this is:<br /><br />                        if (_connector.RegisteredSecurities.Count(s => s.Id == securityId) == 0)<br />                        {<br />                            var onSecurityChanged = new Action<Security>(s =><br />                            {<br />                                if (s.Id != securityId)<br />                                    return;<br />                                if (s.BestBid != null && s.BestAsk != null)<br />                                    waitHandle.Set();<br />                            });<br /><br />                            _connector.SecurityChanged += onSecurityChanged;<br /><br />                            _connector.RegisterSecurity(security);<br />                            waitHandle.WaitOne(30000);<br /><br />                            _connector.SecurityChanged -= onSecurityChanged;<br />                        }<br /><br />                        if ((security.BestBid == null) || (security.BestAsk == null))<br />                        {<br />                            throw new InvalidOperationException("Unable to obtain quotes");<br />                        }<br /><br />The problem is the security does not get registered. Even on a second or third pass. The RegisteredSecurities  collection stays empty.<br /><br />I have tested it with securities with the following ids: "SPZ7@GLOBEX", "SPXW  171215C02580000@SMART"<br /><br />Any help would be greatly appreciated<br /><br />Regards<br /><br />Johan Kirsten