<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7729623616011123820</id><updated>2024-11-01T14:37:44.222+04:00</updated><category term="C#"/><category term="DDE"/><category term="Quik"/><title type='text'>[[ Automation Trading ]]</title><subtitle type='html'>&lt;small&gt;технические аспекты автоматизации торговли             [[&lt;a href=&quot;http://www.free-lance.ru/users/Shestkov&quot;&gt;сотрудничество&lt;/a&gt;]]&lt;/small&gt;</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://automationtrading.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://automationtrading.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ShestkoFF</name><uri>http://www.blogger.com/profile/12864553682656911409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7729623616011123820.post-3917240312912874593</id><published>2011-01-19T17:14:00.000+03:00</published><updated>2011-01-30T10:31:24.649+03:00</updated><title type='text'>HFT: откуда берутся тормоза, и как их мониторить</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; Вот диаграмма того откуда берутся тормоза в наших роботах.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQVijKj3654WGMW8P21eLVwPacHF6ER6By6T45tcFdfy4Apl6WAx_PrrnsDbjJBfpA-DhVeskPypLM5ofxDzsb79lNykdcmqWJHJTs2tCDfjRCTdmriiRugmQ4KL2e8zzTn70PJaYY5hU4/s1600/latency+optimization.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;449&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQVijKj3654WGMW8P21eLVwPacHF6ER6By6T45tcFdfy4Apl6WAx_PrrnsDbjJBfpA-DhVeskPypLM5ofxDzsb79lNykdcmqWJHJTs2tCDfjRCTdmriiRugmQ4KL2e8zzTn70PJaYY5hU4/s640/latency+optimization.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
первоисточник:&amp;nbsp;&lt;a href=&quot;https://www.cisco.com/application/pdf/en/us/guest/netsol/ns407/c654/ccmigration_09186a008091d542.pdf&quot;&gt;https://www.cisco.com/application/pdf/en/us/guest/netsol/ns407/c654/ccmigration_09186a008091d542.pdf&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://automationtrading.blogspot.com/feeds/3917240312912874593/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://automationtrading.blogspot.com/2011/01/design-best-practices-for-latency.html#comment-form' title='Комментарии: 2'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/3917240312912874593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/3917240312912874593'/><link rel='alternate' type='text/html' href='http://automationtrading.blogspot.com/2011/01/design-best-practices-for-latency.html' title='HFT: откуда берутся тормоза, и как их мониторить'/><author><name>ShestkoFF</name><uri>http://www.blogger.com/profile/12864553682656911409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQVijKj3654WGMW8P21eLVwPacHF6ER6By6T45tcFdfy4Apl6WAx_PrrnsDbjJBfpA-DhVeskPypLM5ofxDzsb79lNykdcmqWJHJTs2tCDfjRCTdmriiRugmQ4KL2e8zzTn70PJaYY5hU4/s72-c/latency+optimization.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7729623616011123820.post-7618096464940768756</id><published>2010-08-22T23:03:00.000+04:00</published><updated>2011-01-14T23:11:08.701+03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="DDE"/><category scheme="http://www.blogger.com/atom/ns#" term="Quik"/><title type='text'>Автозапуск экспорта всех таблиц по DDE в Quik на C#</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; Достаточно часто при написании привода или полностью автоматизированной системы работающей в тандеме с Quik необходимо не только уметь отправлять сделки в торговую систему, но и получать из нее различную торговую информацию. К сожалению trans2quik.dll не предоставляет возможности получения какой либо информации о котировках. Поэтому большинство пользователей делают это через  квиковские DDE или ODBC. Первый мне кажется более простым в и понятным в реализации. Необходимо создать свой собственный DDE сервер для приема информации(об этом будет рассказано в следующих постах), после чего в Quik настраиваются таблицы которые будут выводиться. Но вот незадача, получается что при каждом запуска нашей программы придется заходить в Quik и запускать экспорт таблиц. Мне кажется это не очень удобно, но никакой возможности это сделать через trans2quik.dll нет.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; Ниже представлен небольшой код, который находит все запущенные терминалы Quik и запускает экспорт всех таблиц путем нажатия пункта меню &#39;Экспорт Данных -&amp;gt; Начать экспорт таблиц по DDE&#39;.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; Код не требует никаких дополнительных библиотек, вам просто достаточно добавить этот код в свой проект.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;

namespace QuikIntegration.dde
{
    public class QuikUtil
    {
        private static string _exportMenuKey = &quot;Экспорт данных&quot;;
        private static string _stopExportMenuItem = &quot;Остановить экспорт таблиц по &amp;amp;DDE&quot;;
        private static string _startExportByDDEMenuItem = &quot;Начать экспорт таблиц по &amp;amp;DDE&quot;;

        // ReSharper disable InconsistentNaming
        [DllImport(&quot;user32.dll&quot;)]
        static extern IntPtr GetMenu(IntPtr hWnd);

        [DllImport(&quot;user32.dll&quot;)]
        static extern IntPtr GetSubMenu(IntPtr hMenu, int nPos);

        [DllImport(&quot;user32.dll&quot;)]
        static extern int GetMenuItemCount(IntPtr hMenu);

        [DllImport(&quot;user32.dll&quot;)]
        static extern int GetMenuString(IntPtr hMenu, uint uIDItem, StringBuilder lpString, int nMaxCount, uint uFlag);

        [DllImport(&quot;user32.dll&quot;)]
        static extern uint GetMenuItemID(IntPtr hMenu, int nPos);

        [return: MarshalAs(UnmanagedType.Bool)]
        [DllImport(&quot;user32.dll&quot;, SetLastError = true)]
        static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

        private const UInt32 MF_BYPOSITION = 0x00000400;

        public static bool StartDDE()
        {
            IntPtr[] quikWindows = FindQuikWindow();
            if (quikWindows.Length == 0)
            {
                return false;
            }
            foreach (var quikWindow in quikWindows)
            {
                IntPtr mainMenu = GetMenu(quikWindow);
                int exportMenuIndex = (int)FindMenuItemByPart(mainMenu, _exportMenuKey);
                IntPtr exportMenu = GetSubMenu(mainMenu, exportMenuIndex);

                uint exportIndex = 6; // FindMenuItemByPart(exportMenu, _startExportByDDEMenuItem);
                uint menuItem = GetMenuItemID(exportMenu, (int)exportIndex);
                PostMessage(quikWindow, 0x111, (IntPtr)menuItem, (IntPtr)0);
            }

            return true;
        }

        public static bool StopDDE()
        {
            IntPtr[] quikWindows = FindQuikWindow();
            if (quikWindows.Length == 0)
            {
                return false;
            }

            foreach (var quikWindow in quikWindows)
            {
                IntPtr mainMenu = GetMenu(quikWindow);
                int exportMenuIndex = (int)FindMenuItemByPart(mainMenu, _exportMenuKey);
                IntPtr exportMenu = GetSubMenu(mainMenu, exportMenuIndex);

                uint exportIndex = 7; // FindMenuItemByPart(exportMenu, _stopExportMenuItem);
                uint menuItem = GetMenuItemID(exportMenu, (int)exportIndex);
                PostMessage(quikWindow, 0x111, (IntPtr)menuItem, (IntPtr)0);
            }
            return true;
        }

        private static IntPtr[] FindQuikWindow()
        {
            Process[] processes = Process.GetProcessesByName(&quot;info&quot;);
            IntPtr[] result = new IntPtr[processes.Length];
            for (int i = 0; i &amp;lt; processes.Length; i++)
            {
                result[i] = processes[i].MainWindowHandle;
            }
            return result;
        }

        private static uint FindMenuItemByPart(IntPtr menu, string name)
        {
            int menuItemsCount = GetMenuItemCount(menu);
            for (uint menuIndex = 0; menuIndex &amp;lt; menuItemsCount; menuIndex++)
            {
                StringBuilder result = new StringBuilder();
                GetMenuString(menu, menuIndex, result, 1024, MF_BYPOSITION);
                string buffer = result.ToString();
                if (buffer.Contains(name))
                {
                    return menuIndex;
                }
            }
            return 0;
        }
    }
    // ReSharper restore InconsistentNaming
}
&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Для того, чтобы запустить экспорт всех таблиц нужно выполнить комманду:&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;QuikUtil.StartDDE();
&lt;/pre&gt;остановить&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;QuikUtil.StopDDE();
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://automationtrading.blogspot.com/feeds/7618096464940768756/comments/default' title='Комментарии к сообщению'/><link rel='replies' type='text/html' href='http://automationtrading.blogspot.com/2010/08/dde.html#comment-form' title='Комментарии: 14'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/7618096464940768756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/7618096464940768756'/><link rel='alternate' type='text/html' href='http://automationtrading.blogspot.com/2010/08/dde.html' title='Автозапуск экспорта всех таблиц по DDE в Quik на C#'/><author><name>ShestkoFF</name><uri>http://www.blogger.com/profile/12864553682656911409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7729623616011123820.post-1663397365817990389</id><published>2010-08-21T13:59:00.003+04:00</published><updated>2011-04-13T07:16:22.952+04:00</updated><title type='text'>Зачем мне нужен этот блог</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Этот блог призван помочь мне структурировать свои знания о трейдинге, а в частности такой его разновидности как алгоритмический или автотрейдинг. А если мои записки когда нибудь кому-то помогут, то это будет замечательно.&lt;br /&gt;
&lt;a href=&quot;http://www.free-lance.ru/users/Shestkov&quot;&gt;&lt;b&gt;сотрудничество&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/1663397365817990389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7729623616011123820/posts/default/1663397365817990389'/><link rel='alternate' type='text/html' href='http://automationtrading.blogspot.com/2010/08/test.html' title='Зачем мне нужен этот блог'/><author><name>ShestkoFF</name><uri>http://www.blogger.com/profile/12864553682656911409</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>