﻿<?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">security. StockSharp</title>
  <id>https://stocksharp.ru/handlers/atom.ashx?category=tag&amp;id=security&amp;type=forum</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-20T18:14:03Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=tag&amp;id=security&amp;type=forum" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/topic/11695/</id>
    <title type="text">Как убрать тестовый портфель, инструмент из Connector так, чтобы графические контролы отображали актуальные данные</title>
    <published>2020-04-22T21:37:41Z</published>
    <updated>2020-05-05T13:42:41Z</updated>
    <author>
      <name>Дмитрий_</name>
      <uri>https://stocksharp.ru/users/62269/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <category term="Portfolio" />
    <category term="Security" />
    <category term="Connector" />
    <content type="html">&lt;p&gt;Добрый день&lt;/p&gt;
&lt;p&gt;На примере портфеля. (Если я правильно понимаю, инструмент удаляется аналогично)&lt;/p&gt;
&lt;p&gt;В Shell есть метод AddPortfolio(Portfolio portfolio), благодаря которому появляется возможность выбора портфеля при тестировании.&lt;/p&gt;
&lt;p&gt;Применяю
var storageEntityPortfolioList = ConfigManager.GetService&amp;lt;IStorageEntityList&amp;lt;Portfolio&amp;gt;&amp;gt;();
storageEntityPortfolioList.Remove(portfolio);
и
var removeMessage = new RemoveMessage
;
Connector.SendOutMessage(removeMessage);&lt;/p&gt;
&lt;p&gt;Данные в графическом Portfolio контроле обновляются только после перезагрузки приложения, но не в реальном времени.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <id>https://stocksharp.ru/topic/10588/</id>
    <title type="text">Сохранение инструментов приводит к дубликатам</title>
    <published>2019-04-06T19:24:24Z</published>
    <updated>2019-04-11T11:32:22Z</updated>
    <author>
      <name>Дмитрий_</name>
      <uri>https://stocksharp.ru/users/62269/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <category term="QuikLua" />
    <category term="Security" />
    <content type="html">&lt;p&gt;В событии Connector_NewSecurity сохраняю security&lt;/p&gt;
&lt;div class="spoiler"&gt;&lt;p&gt;private static void Connector_NewSecurity(Security security)
{
storageRegistry.GetSecurityStorage().Save(security, true /&lt;em&gt;или false&lt;/em&gt;/);
}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Почему при каждом запуске программы, файл instruments.csv дублируется инструментами.&lt;/p&gt;
&lt;p&gt;Есть вариант с&lt;/p&gt;
&lt;details&gt;&lt;summary&gt;foreach (var security in storageRegistry.GetSecurityStorage().LookupAll())
{
securityIdsFromStorage.Add(security.Id);
}&lt;/summary&gt;
&lt;div class="и"&gt;&lt;p&gt;После 5-ти запусков программы - количество строк в instruments.csv увеличилось в 5 раз инструментами, которые в файле уже есть.
Как уйти от данного поведения?&lt;/p&gt;
&lt;/details&gt;&lt;/div&gt;</content>
  </entry>
  <entry>
    <id>https://stocksharp.ru/topic/10576/</id>
    <title type="text">Сериализация (xml) класса Security</title>
    <published>2019-04-02T02:18:21Z</published>
    <updated>2019-04-06T19:07:57Z</updated>
    <author>
      <name>Дмитрий_</name>
      <uri>https://stocksharp.ru/users/62269/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <category term="Quik" />
    <category term="Lua" />
    <category term="Security" />
    <category term="xml" />
    <content type="html">&lt;p&gt;Добрый день
Имею Quik Lua коннектор.
Примерно 1 - 1,5 года назад сериализация класса Security проходила успешно.&lt;/p&gt;
&lt;p&gt;Провел сериализацию сегодня и получил 8  ошибок:
1 InvalidOperationException: There was an error reflecting property 'Board'.
2 InvalidOperationException: There was an error reflecting type 'StockSharp.BusinessEntities.ExchangeBoard'.
3 InvalidOperationException: There was an error reflecting property 'WorkingTime'.
4 InvalidOperationException: There was an error reflecting type 'StockSharp.Messages.WorkingTime'.
5 InvalidOperationException: There was an error reflecting property 'Periods'.
6 InvalidOperationException: There was an error reflecting type 'StockSharp.Messages.WorkingTimePeriod'.
7 InvalidOperationException: Cannot serialize member 'StockSharp.Messages.WorkingTimePeriod.SpecialDays' of type 'System.Collections.Generic.IDictionary&lt;code&gt;2[[System.DayOfWeek, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Ecng.ComponentModel.Range&lt;/code&gt;1[[System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][], Ecng.ComponentModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b10e79ed0227b515]]', see inner exception for more details.
8 NotSupportedException: Cannot serialize member StockSharp.Messages.WorkingTimePeriod.SpecialDays of type System.Collections.Generic.IDictionary&lt;code&gt;2[[System.DayOfWeek, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Ecng.ComponentModel.Range&lt;/code&gt;1[[System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][], Ecng.ComponentModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b10e79ed0227b515]] because it is an interface.&lt;/p&gt;
&lt;p&gt;Это баг или невозможность сериализации реализовано с определенной целью?&lt;/p&gt;
</content>
  </entry>
</feed>