﻿<?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">Проблемы со стаканом</title>
  <id>~/topic/3561/problemy-so-stakanom/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-10T13:16:47Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=topic&amp;id=3561" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/posts/m/25210/</id>
    <title type="text">Программа подклчается к квику, включается экспорт по dde, экспорт инструментов и портфелей, генериру...</title>
    <published>2013-04-07T17:34:20Z</published>
    <updated>2013-04-09T08:48:33Z</updated>
    <author>
      <name>Asantasan</name>
      <uri>https://stocksharp.com/users/38910/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;p&gt;Программа подклчается к квику, включается экспорт по dde, экспорт инструментов и портфелей, генерируется стакан. Но лучший бид по прежнему не выводится в textBox.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using StockSharp.Quik;
using Ecng.Xaml;
using StockSharp.BusinessEntities;
using StockSharp.Algo;
using Ecng.Common;
using Ecng.ComponentModel;
using System.Configuration;


namespace WpfApplication1
{
    /// &amp;lt;summary&amp;gt;
    /// Логика взаимодействия для MainWindow.xaml
    /// &amp;lt;/summary&amp;gt;
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private QuikTrader _trader;
        private Security _lkoh;
        private MarketDepth _depth;
        const string secCode = &amp;quot;LKOH&amp;quot;;
        public IEnumerable&amp;lt;Security&amp;gt; securities;
       public void ProcessMarketDepths(MarketDepth marketDepth)
        {
            //textBox1.Text=Convert.ToString(marketDepth.BestAsk);
        }
        private void button1_Click(object sender, RoutedEventArgs e)
       {
           //Security _lkoh = new Security();
         //  MarketDepth _depth = new MarketDepth(_lkoh);
            _trader = new QuikTrader(QuikTerminal.GetDefaultPath());
           /* _trader.NewSecurities +=securities =&amp;gt; this.GuiAsync(() =&amp;gt;
            {
                Securitites.ItemsSource = _trader.Securities;
              //  _lkoh = securities.FirstOrDefault(sec =&amp;gt; sec.Code == secCode);  
            //    _trader.RegisterMarketDepth(_lkoh);
               
    });*/

 
            _trader.NewPortfolios += portfolios =&amp;gt; this.GuiAsync(() =&amp;gt;
            {

                Portfolios.ItemsSource = _trader.Portfolios;
            });


          
                  //  _trader.Connected += () =&amp;gt; _trader.StartExport();
                //    _trader.Connect();

                   //_trader.MarketDepthsChanged += depths =&amp;gt;
                   // {
                   //     if (_depth == null &amp;amp;&amp;amp; _lkoh != null)
                   //     {
                   //         _depth = depths.FirstOrDefault(d =&amp;gt; d.Security == _lkoh);

                   //         if (_depth != null)
                   //         {
                   //            MessageBox.Show(&amp;quot;Стакан Лукойла появился.&amp;quot;,&amp;quot;Dct xbnrfy&amp;quot;);

                                
                   //         }
                   //     }
                  //  };
       
        
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
 Security _lkoh = new Security();
           MarketDepth _depth = new MarketDepth(_lkoh);
         //  _trader.Connected += () =&amp;gt; _trader.StartExport();
           _trader.Connect();
          // _trader = new QuikTrader(QuikTerminal.GetDefaultPath());
           _trader.NewSecurities += securities =&amp;gt; this.GuiAsync(() =&amp;gt;
           {
               Securitites.ItemsSource = _trader.Securities;
                _lkoh = securities.FirstOrDefault(sec =&amp;gt; sec.Code == secCode);  
                  _trader.RegisterMarketDepth(_lkoh);

           });
           _trader.StartExport(new[]{ _trader.SecuritiesTable, _trader.MyTradesTable, _trader.EquityPositionsTable,
_trader.EquityPortfoliosTable, _trader.OrdersTable });

           _trader.MarketDepthsChanged += depths =&amp;gt;
                      {
                          if (_depth == null &amp;amp;&amp;amp; _lkoh != null)
                          {
                              _depth = depths.FirstOrDefault(d =&amp;gt; d.Security == _lkoh);

                              if (_depth != null)
                              {
                                  MessageBox.Show(&amp;quot;Стакан Лукойла появился.&amp;quot;, &amp;quot;Dct xbnrfy&amp;quot;);

                                  textBox1.Text = Convert.ToString(_lkoh.BestAsk.Price);
                              }
                             
                          
                          }
                      };
         
        }
            }
        }

  
       
        
        }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Код частично взят из примера. Но пример консольный и прекрасно работает. А мой нет.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/25209/</id>
    <title type="text">Asantasan: выскакивает сообщение, что необходимо &amp;quot;зарезервированное слово new&amp;quot;. Как вы понимаете, &amp;quot; ...</title>
    <published>2013-04-07T15:16:35Z</published>
    <updated>2013-04-07T15:16:35Z</updated>
    <author>
      <name>VassilSanych</name>
      <uri>https://stocksharp.com/users/6491/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="@message(25207)" rel="nofollow" target="_blank"&gt;Asantasan&lt;/a&gt;:&lt;/strong&gt;
выскакивает сообщение, что необходимо &amp;quot;зарезервированное слово new&amp;quot;. Как вы понимаете, &amp;quot; new&amp;quot; результатов не дало. Подскажите пожалуйста.
&lt;a href="http://msdn.microsoft.com/ru-ru/library/6fawty39.aspx" target="_blank"&gt;вот&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/25207/</id>
    <title type="text">Здравствуйте. Не могу понять, как получать bestask, bestbid и т.д. от квика. Работать с документацие...</title>
    <published>2013-04-07T13:02:15Z</published>
    <updated>2013-04-07T13:05:23Z</updated>
    <author>
      <name>Asantasan</name>
      <uri>https://stocksharp.com/users/38910/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;p&gt;Здравствуйте. Не могу понять, как получать bestask, bestbid и т.д. от квика. Работать с документацией в должной мере еще не могу. Использую вот такой код:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;private void button4_Click(object sender, RoutedEventArgs e)
        {
            var md = _trader.GetMarketDepth((Security)Securitites.SelectedItem);
              textBox2.Text=Convert.ToString(md.GetBestQuote(OrderDirections.Buy).Price);      
        
        }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Но выскакивает сообщение, что необходимо &amp;quot;зарезервированное слово new&amp;quot;. Как вы понимаете, &amp;quot; new&amp;quot; результатов не дало. Подскажите пожалуйста.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>