﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">registeredsecurities. StockSharp</title>
  <id>https://stocksharp.com/handlers/atom.ashx?category=tag&amp;id=registeredsecurities&amp;type=community</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-10T11:50:13Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=tag&amp;id=registeredsecurities&amp;type=community" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/topic/8767/</id>
    <title type="text">Problems registering security for level 1 price updates</title>
    <published>2017-10-29T22:07:59Z</published>
    <updated>2017-11-01T22:54:50Z</updated>
    <author>
      <name>Johan Kirsten</name>
      <uri>https://stocksharp.com/users/99799/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="RegisterSecurity" />
    <category term="RegisteredSecurities" />
    <content type="html">&lt;p&gt;I 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:&lt;/p&gt;
&lt;p&gt;if (_connector.RegisteredSecurities.Count(s =&amp;gt; s.Id == securityId) == 0)
{
var onSecurityChanged = new Action&lt;Security&gt;(s =&amp;gt;
{
if (s.Id != securityId)
return;
if (s.BestBid != null &amp;amp;&amp;amp; s.BestAsk != null)
waitHandle.Set();
});&lt;/p&gt;
&lt;p&gt;_connector.SecurityChanged += onSecurityChanged;&lt;/p&gt;
&lt;p&gt;_connector.RegisterSecurity(security);
waitHandle.WaitOne(30000);&lt;/p&gt;
&lt;p&gt;_connector.SecurityChanged -= onSecurityChanged;
}&lt;/p&gt;
&lt;p&gt;if ((security.BestBid == null) || (security.BestAsk == null))
{
throw new InvalidOperationException(&amp;quot;Unable to obtain quotes&amp;quot;);
}&lt;/p&gt;
&lt;p&gt;The problem is the security does not get registered. Even on a second or third pass. The RegisteredSecurities  collection stays empty.&lt;/p&gt;
&lt;p&gt;I have tested it with securities with the following ids: &amp;quot;SPZ7@GLOBEX&amp;quot;, &amp;quot;SPXW  171215C02580000@SMART&amp;quot;&lt;/p&gt;
&lt;p&gt;Any help would be greatly appreciated&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Johan Kirsten&lt;/p&gt;
</content>
  </entry>
</feed>