<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: sendTransaction не вернула ошибку]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме sendTransaction не вернула ошибку форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Mon, 06 Apr 2026 15:02:05 +0300</pubDate>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78331/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Спасибо всем. <br />
			<i>31.03.2025 22:41:28, ЭД.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78331/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78331/topic9095/</guid>
			<pubDate>Mon, 31 Mar 2025 22:41:28 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78304/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_AyuKNhrU" href="/user/15079/" bx-tooltip-user-id="15079">ЭД</a> написал:<br />Спасибо.<br />Нет у вас хорошего примера под рукой OnTransReply) ?<br />=============<br />У меня этот колбек реализован так:
====code====
<pre>local t_mes={
"отправлена серверу",
"получена на сервер QUIK от клиента",
"ошибка при передаче транзакции в торговую систему. Так как отсутствует подключение шлюза Московской Биржи",
"выполнена",
"не выполнена торговой системой. Более подробное описание ошибки отражается в поле «Сообщение»",
"не прошла проверку сервера QUIK по каким-либо критериям. Например, проверку на наличие прав у пользователя на отправку транзакции данного типа",
"не прошла проверку лимитов сервера QUIK",
"не поддерживается торговой системой",
"не прошла проверку правильности электронной цифровой подписи",
"не удалось дождаться ответа на транзакцию, т.к. истек таймаут ожидания",
"отвергнута, так как ее выполнение могло привести к кросс-сделке",
"не прошла контроль дополнительных ограничений, установленных брокером",
"принята после нарушения дополнительных ограничений, установленных брокером",
"отменена пользователем в ходе проверки дополнительных ограничений, установленных брокером" }

function OnTransReply(t)
&nbsp;&nbsp;&nbsp;local x=t.status
&nbsp;&nbsp;&nbsp;if Log then Log:write("status="..x..": транзакция "..t_mes&#91;x+1&#93;.."&#62;"..msg.."&#92;n"); Log:flush();end
&nbsp;&nbsp;&nbsp;if x==3 or 2&#62;x or x==15 then return end
&nbsp;&nbsp;&nbsp;---удаляем ошибочные транзакции сделок
&nbsp;&nbsp;&nbsp;local _id=t.trans_id; local e,j,M;
&nbsp;&nbsp;&nbsp;for n=1,2 do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e=tor&#91;n&#93;; j=0; M=#e; while M&#62;j do j=j+1; u=e&#91;j&#93;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if u&#91;1&#93;==id_ then if M&#62;j then e&#91;j&#93;=e&#91;M&#93;; end&nbsp;&nbsp;e&#91;M&#93;=nil; e&#91;0&#93;=e&#91;0&#93;-1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if Log then Log:write("transReply "..",e&#91;0&#93;="..e&#91;0&#93;..",#e="..#e.."&#92;n");Log:flush(); end
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return; end&nbsp;&nbsp;--отменяем выставление заявки
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if #u==3 and u&#91;3&#93;==id_ then u&#91;3&#93;=nil ;e&#91;0&#93;=e&#91;0&#93;-1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if Log then Log:write("transReply "..",e&#91;0&#93;="..e&#91;0&#93;..",#e="..#e.."&#92;n");Log:flush(); end
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return; end&nbsp;&nbsp;-- отменяем удаление
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;end
end</pre>
============= <br />
			<i>31.03.2025 06:33:45, nikolz.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78304/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78304/topic9095/</guid>
			<pubDate>Mon, 31 Mar 2025 06:33:45 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78303/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_Ykh69Atq" href="/user/15079/" bx-tooltip-user-id="15079">ЭД</a>, добрый день.<br /><br />Примеры использования OnTransReply см. сс.35-40 документа <noindex><a href="https://arqatech.com/upload/iblock/114/quik_lua.zip" target="_blank" rel="nofollow">&quot;Использование Lua в Рабочем месте</a></noindex><noindex><a href="https://arqatech.com/upload/iblock/114/quik_lua.zip" target="_blank" rel="nofollow">QUIK&quot;</a></noindex>. <br />
			<i>31.03.2025 06:14:52, Anton Belonogov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78303/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78303/topic9095/</guid>
			<pubDate>Mon, 31 Mar 2025 06:14:52 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78286/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Спасибо.<br />Нет у вас хорошего примера под рукой OnTransReply) ? <br />
			<i>30.03.2025 20:22:45, ЭД.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78286/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78286/topic9095/</guid>
			<pubDate>Sun, 30 Mar 2025 20:22:45 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78273/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_nB7nBNXp" href="/user/15079/" bx-tooltip-user-id="15079">ЭД</a> написал:<br />Добрый день<br /><br /><br />Простой код снятия стоп-заявки, в момент вызова стоп-заявка исполняется<br /><br /> function drop_stop_order(p_trans_id) &nbsp;<br /> &nbsp; &nbsp; -- &nbsp;<br /> &nbsp; &nbsp;local bs, res = {}, &quot;&quot; <br /> &nbsp; &nbsp; <br /> &nbsp; &nbsp;message(&#39;Begin drop_stop_order trans_id=&#39; .. p_trans_id) <br /> &nbsp; &nbsp; <br /> &nbsp; &nbsp;for i=0,(tonumber(getNumberOf(&quot;stop_orders&quot;))-1) do &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp;bs=getItem(&quot;stop_orders&quot;,i) <br /> &nbsp; &nbsp; &nbsp;if bit.band(bs.flags, 1)~=0 &nbsp;and bs.trans_id == p_trans_id then <br /> &nbsp; &nbsp; &nbsp; &nbsp;message(&#39;Send drop stop-order trans_id=&#39;..bs.trans_id); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;local Transaction={ <br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;TRANS_ID&quot;&#93; &nbsp; &nbsp; = tostring(bs.trans_id), &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; &nbsp; = &quot;KILL_STOP_ORDER&quot;, <br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;CLASSCODE&quot;&#93; &nbsp; &nbsp;= &#39;SPBFUT&#39;, <br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp; &nbsp;= &#39;SiH5&#39;, -- инструмент <br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;STOP_ORDER_KEY&quot;&#93; = tostring(bs.ordernum), <br /> &nbsp; &nbsp; &nbsp; &nbsp; &#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp; &nbsp; &nbsp;= &#39;SPBFUTxxx&#39; <br /> &nbsp; &nbsp; &nbsp; &nbsp; } <br /> &nbsp; &nbsp; &nbsp;-- Если функция вернула строку диагностики ошибки, то значит транзакция не прошла &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp;local Result = sendTransaction(Transaction); <br /> &nbsp; &nbsp; &nbsp; &nbsp;if Result ~= &quot;&quot; then <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message(&quot;Drop stop-order error!\nОШИБКА: &quot;..tostring(Result)); <br /> &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp;<br /><br /> &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp;<br /> &nbsp; end &nbsp;end &nbsp; &nbsp; <br /><br /><br />В терминале сообщения:<br /> Begin drop_stop_order trans_id=142604 <br /> Send drop stop-order trans_id=142604 <br />и в обход скрипта насколько понял сообщение: &nbsp;Не удается снять стоп-заявку N &#91;1217138444&#93; <br /><br />То есть сообщения &nbsp;&quot;Drop stop-order error!\nОШИБКА: &quot;..tostring(Result) &nbsp;нет, а должно судя по документации.<br />Почему sendTransaction не вернула ошибку??<br />=============<br /> sendTransaction &nbsp;возвращает ошибки обнаруженные &nbsp;терминалом,<br />а полученную Вами ошибку прислала биржа.<br />Вы ее получите в колбеке. <br />
			<i>27.03.2025 16:28:19, nikolz.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78273/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78273/topic9095/</guid>
			<pubDate>Thu, 27 Mar 2025 16:28:19 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>sendTransaction не вернула ошибку</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message78268/topic9095/">sendTransaction не вернула ошибку</a></b> <i>Поведение sendTransaction не по документации</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день<br /><br /><br />Простой код снятия стоп-заявки, в момент вызова стоп-заявка исполняется<br /><br /><span class="bx-font" style="font-family:Courier New">function drop_stop_order(p_trans_id) </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp;-- </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; local bs, res = {}, &quot;&quot;</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; message(&#39;Begin drop_stop_order trans_id=&#39; .. p_trans_id)</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; for i=0,(tonumber(getNumberOf(&quot;stop_orders&quot;))-1) do &nbsp; &nbsp;</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; bs=getItem(&quot;stop_orders&quot;,i)</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; if bit.band(bs.flags, 1)~=0 &nbsp;and bs.trans_id == p_trans_id then</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; message(&#39;Send drop stop-order trans_id=&#39;..bs.trans_id); &nbsp; &nbsp; &nbsp; &nbsp; </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; local Transaction={</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;TRANS_ID&quot;&#93; &nbsp; &nbsp; = tostring(bs.trans_id), </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; &nbsp; = &quot;KILL_STOP_ORDER&quot;,</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;CLASSCODE&quot;&#93; &nbsp; &nbsp;= &#39;SPBFUT&#39;,</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp; &nbsp;= &#39;SiH5&#39;, -- инструмент</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;STOP_ORDER_KEY&quot;&#93; = tostring(bs.ordernum),</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp; &nbsp; &nbsp;= &#39;SPBFUTxxx&#39;</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp;}</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; -- Если функция вернула строку диагностики ошибки, то значит транзакция не прошла &nbsp; &nbsp;</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; local Result = sendTransaction(Transaction);</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; if Result ~= &quot;&quot; then</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; &nbsp; message(&quot;Drop stop-order error!\nОШИБКА: &quot;..tostring(Result));</span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; &nbsp; end </span><br /><br /><span class="bx-font" style="font-family:Courier New"> &nbsp; &nbsp; end &nbsp; </span><br /><span class="bx-font" style="font-family:Courier New"> &nbsp;end</span><span class="bx-font" style="font-family:Courier New">end &nbsp; &nbsp;</span><br /><br /><br />В терминале сообщения:<br /><span class="bx-font" style="font-family:Courier New">Begin drop_stop_order trans_id=142604</span><br /><span class="bx-font" style="font-family:Courier New">Send drop stop-order trans_id=142604</span><br />и в обход скрипта насколько понял сообщение: <span class="bx-font" style="font-family:Courier New">Не удается снять стоп-заявку N &#91;1217138444&#93;</span><br /><br />То есть сообщения <span class="bx-font" style="font-family:Courier New">&quot;Drop stop-order error!\nОШИБКА: &quot;..tostring(Result)</span> нет, а должно судя по документации.<br />Почему sendTransaction не вернула ошибку?? <br />
			<i>27.03.2025 12:40:32, ЭД.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message78268/topic9095/</link>
			<guid>http://forum.quik.ru/messages/forum10/message78268/topic9095/</guid>
			<pubDate>Thu, 27 Mar 2025 12:40:32 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
