﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">Не вызываются события стакана</title>
  <id>~/topic/1134/ne-vyzyvayutsya-sobytiya-stakana/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-07T11:37:21Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=topic&amp;id=1134" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/posts/m/3974/</id>
    <title type="text">Спасибо. Получилось </title>
    <published>2010-09-20T18:18:00Z</published>
    <updated>2010-09-20T18:18:00Z</updated>
    <author>
      <name>Lafert</name>
      <uri>https://stocksharp.ru/users/26871/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Спасибо. Получилось&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/3973/</id>
    <title type="text">Иду по шагам: f (Securities.IndexOf(mysec =&amp;gt; mysec.security.Equals(security as Security)) &amp;lt; 0) думаю...</title>
    <published>2010-09-20T17:19:00Z</published>
    <updated>2010-09-20T17:19:00Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Иду по шагам:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;f (Securities.IndexOf(mysec =&amp;gt; mysec.security.Equals(security as
Security)) &amp;lt; 0)  думаю можно смело заменить на Securities.Contains&lt;/li&gt;
&lt;li&gt;Нельзя создавать объекты по new. Это делает сам шлюз. Как
результат, шлюз изменяется совсем другой объект, нежели Ваш. Это
касается всего, кроме заявок. Получайте объект стакана из
ITrader.GetQuotes(Security).&lt;/li&gt;
&lt;li&gt;Насчет закрытия не понял. Где получаете ошибку с очередью? В Квике?
Так Вы же его закрываете.&lt;/li&gt;
&lt;/ol&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/3972/</id>
    <title type="text"> _trader.NewSecurities += (securities) =&amp;gt; { foreach(Security security in securities) { if (Securitie...</title>
    <published>2010-09-20T17:08:00Z</published>
    <updated>2010-09-20T17:08:00Z</updated>
    <author>
      <name>Lafert</name>
      <uri>https://stocksharp.ru/users/26871/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;pre&gt;&lt;code&gt;       _trader.NewSecurities += (securities) =&amp;gt;
            {
                foreach(Security security in securities)
                {
                    if (Securities.IndexOf(mysec =&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;mysec.security.Equals(security as Security)) &amp;lt; 0)
{
MarketDepth stakan = new
MarketDepth(security);
stakan.QuotesChanged += (odr, quotes) =&amp;gt;
{
foreach (Quote qt in quotes.Values)
{
to_log(&amp;quot;{0} {1} {2}
{3}&amp;quot;.Put(stakan.Security.Id, odr, qt.Price, qt.Volume));
}
};
stakan.UpdatingStarted += () =&amp;gt;
{
to_log(&amp;quot;{0}
stakan.UpdatingStarted&amp;quot;.Put(security.Id));
};
stakan.UpdatingFinished += () =&amp;gt;
{
to_log(&amp;quot;{0}
stakan.UpdatingFinished&amp;quot;.Put(stakan.Security.Id));
StakanUpdated(stakan);
};
AddSecurities(security, stakan);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                   }
                }
            };
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;public void AddSecurities(Security security, MarketDepth stakan)
{
if (security == null)
throw new ArgumentNullException(&amp;quot;security&amp;quot;);
int _daily_sqlId = 0;
try
{
_trader.RegisterQuotes(security);
}
catch (Exception ex) { to_log(ex.Message); }
Securities.Add(security);
_security_stakans.Add(security, stakan);
to_log(&amp;quot;Добавлен инструмент {0}&amp;quot;.Put(security.Id));
}&lt;/p&gt;
&lt;p&gt;После этого стаканы в квике регитрируются, но событий не происходит.
Не происходити события ProcessUnknownDdeData.
После закрытия квика в окне сообщений Квика - переполнена очередь
сообщений по инструмкенту.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/3971/</id>
    <title type="text">Приведите код обработчика. Не понятно с описания. </title>
    <published>2010-09-20T16:51:00Z</published>
    <updated>2010-09-20T16:51:00Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Приведите код обработчика. Не понятно с описания.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/3970/</id>
    <title type="text">В событии NewSecurities в цикле получаю security, стакан, добавляю к нему события QuotesChanged и Up...</title>
    <published>2010-09-20T16:00:00Z</published>
    <updated>2010-09-20T16:00:00Z</updated>
    <author>
      <name>Lafert</name>
      <uri>https://stocksharp.ru/users/26871/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;В событии NewSecurities в цикле получаю security, стакан, добавляю к
нему события QuotesChanged и UpdateFinished и вставляю стакан в
коллекцию. RegisterQuotes происходит, но события не вызываются.&lt;/p&gt;
&lt;p&gt;Если работаю с одним инструментом и стакан - переменная класса, то все
работает.
Что я не так делаю?&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>