<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[QUIK -> DDE &mdash; Сколько бумаг в портфеле?]]></title>
	<link rel="self" href="https://quik2dde.ru/extern.php?action=feed&amp;tid=99&amp;type=atom" />
	<updated>2014-07-25T18:34:17Z</updated>
	<generator>PunBB</generator>
	<id>https://quik2dde.ru/viewtopic.php?id=99</id>
		<entry>
			<title type="html"><![CDATA[Re: Сколько бумаг в портфеле?]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=603#p603" />
			<content type="html"><![CDATA[<p>Огромное спасибо</p>]]></content>
			<author>
				<name><![CDATA[arkada38]]></name>
				<uri>https://quik2dde.ru/profile.php?id=202</uri>
			</author>
			<updated>2014-07-25T18:34:17Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=603#p603</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Сколько бумаг в портфеле?]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=602#p602" />
			<content type="html"><![CDATA[<p>Вот такой скрипт выведет остаток по указанной бумаге:</p><div class="codebox"><pre><code>CLIENTCODE = &quot;qtest813&quot;
FIRM       = &quot;NC0011100000&quot;
INSTRUMENT = &quot;LKOH&quot;
ACCOUNT    = &quot;NL0011100043&quot;

function LB()
    n = getNumberOf(&quot;depo_limits&quot;)
    value = 0
    res = nil
    for y = 0, n-1 do
        trade = getItem(&quot;depo_limits&quot;, y)
        if (trade[&quot;client_code&quot;] == CLIENTCODE)  and
                (trade[&quot;firmid&quot;] == FIRM)        and
                (trade[&quot;sec_code&quot;] ==INSTRUMENT) and
                (trade[&quot;trdaccid&quot;] == ACCOUNT)   and
                (trade[&quot;limit_kind&quot;] == 2)        then
            res = trade[&quot;currentbal&quot;]
            break
        end
    end
    return res
end

message(tostring(LB()), 0)</code></pre></div><p>Либо можно синтаксически к таблицам Lua обращаться иначе:</p><div class="codebox"><pre><code>CLIENTCODE = &quot;qtest813&quot;
FIRM       = &quot;NC0011100000&quot;
INSTRUMENT = &quot;LKOH&quot;
ACCOUNT    = &quot;NL0011100043&quot;

function LB()
    n = getNumberOf(&quot;depo_limits&quot;)
    value = 0
    res = nil
    for y = 0, n-1 do
        trade = getItem(&quot;depo_limits&quot;, y)
        if (trade.client_code == CLIENTCODE)  and
                (trade.firmid == FIRM)        and
                (trade.sec_code ==INSTRUMENT) and
                (trade.trdaccid == ACCOUNT)   and
                (trade.limit_kind == 2)        then
            res = trade.currentbal
            break
        end
    end
    return res
end

message(tostring(LB()), 0)</code></pre></div><p>В смысле смысла, эти два варианта кода полностью эквивалентны.</p>]]></content>
			<author>
				<name><![CDATA[swerg]]></name>
				<uri>https://quik2dde.ru/profile.php?id=78</uri>
			</author>
			<updated>2014-07-25T18:12:59Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=602#p602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Сколько бумаг в портфеле?]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=601#p601" />
			<content type="html"><![CDATA[<p>Добрый вечер. Пытаюсь перевести робота с QPile на Qlua. И никак не пойму как получить купленное количество лотов. Вот код на QPile для получения количества бумаг<br /></p><div class="codebox"><pre><code>FUNC LB()
    n=GET_NUMBER_OF(&quot;DEPO_LIMITS&quot;)
    value=0
    RESULT = &quot;&quot;
    FOR y FROM 1 to n
        trade=GET_ITEM (&quot;DEPO_LIMITS&quot;, y)
        IF (GET_VALUE(trade,&quot;CLIENT_CODE&quot;)==CLIENTCODE&amp;&quot;&quot;) AND _
                (GET_VALUE(trade,&quot;FIRMID&quot;)==FIRM&amp;&quot;&quot;) AND _
                (GET_VALUE(trade,&quot;SECCODE&quot;)==INSTRUMENT&amp;&quot;&quot;) AND _
                (GET_VALUE(trade,&quot;TRDACCID&quot;)==ACCOUNT&amp;&quot;&quot;) AND _
                (GET_VALUE(trade,&quot;LIMIT_KIND&quot;)+0==2)
            RESULT=(GET_VALUE(trade,&quot;CURRENT_BALANCE&quot;)+0)/l
            BREAK
        END IF
    END FOR
END FUNC</code></pre></div><p>Как должна выглядеть функция на QLua? Заранее спасибо.</p>]]></content>
			<author>
				<name><![CDATA[arkada38]]></name>
				<uri>https://quik2dde.ru/profile.php?id=202</uri>
			</author>
			<updated>2014-07-25T14:25:49Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=601#p601</id>
		</entry>
</feed>
