1.54K 浏览
0
<span class="n">api</span><span class="o">.</span><span class="n">insert_order</span><span class="p">(</span><span class="n">symbol</span><span class="o">=</span><span class="s2">"DCE.m2207"</span><span class="p">,</span> <span class="n">direction</span><span class="o">=</span><span class="s2">"BUY"</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="s2">"OPEN"</span><span class="p">,</span> <span class="n">volume</span><span class="o">=</span><span class="mi">5</span><span class="p">),这是平掉5手,
我看 <code><span class="pre">insert_order()</span></code> 函数:</span>
<span class="s2">"volume_condition"</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span>  <span class="c1"># "ANY" (手数条件, ANY=任何数量, MIN=最小数量, ALL=全部数量)
我设定all时,总显示错误
order = api.insert_order(symbol="CZCE.TA409", direction="SELL", offset="CLOSE", volume= all )
我设定all时,总显示错误,显示如下:

 order = api.insert_order(symbol="CZCE.MA407", direction="SELL", offset="CLOSE", volume= all )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\tqsdk\api.py", line 1255, in insert_order
volume = int(volume)
^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
Task was destroyed but it is pending!</span>
李思恒 已回答的问题 2024年4月25日
0

只能指定数量,你这个是自己创造参数了,交易所没有命令是全平

李思恒 已回答的问题 2024年4月25日
您正在查看1个答案中的1个,单击此处查看所有答案。