Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IBKR交易停止指令触发方法覆盖(Python)_Python_Api_Algorithmic Trading - Fatal编程技术网

IBKR交易停止指令触发方法覆盖(Python)

IBKR交易停止指令触发方法覆盖(Python),python,api,algorithmic-trading,Python,Api,Algorithmic Trading,我刚开始学习交互式代理Python API。我有一个问题,关于如何覆盖下达止损单的触发方法 IB帮助文档说明: @staticmethod def Stop(action:str, quantity:float, stopPrice:float): # ! [stop] order = Order() order.action = action order.orderType = "STP" order.auxPrice =

我刚开始学习交互式代理Python API。我有一个问题,关于如何覆盖下达止损单的触发方法

IB帮助文档说明:

@staticmethod
def Stop(action:str, quantity:float, stopPrice:float):
    
    # ! [stop]
    order = Order()
    order.action = action
    order.orderType = "STP"
    order.auxPrice = stopPrice
    order.totalQuantity = quantity
    # ! [stop]
    return order
同样对于触发方法:

触发方法
IBApi.Order
类中定义的触发方法指定如何触发模拟停止、停止限制、后续停止和条件命令。有效值为:

  • 0-仪器的默认方法
  • 1-“双重出价/询问”功能,其中基于 连续两次出价或要价
  • 2-“最后一次”功能,根据 最后价格
  • 3-“双末次”功能
  • 4-出价/询问功能
  • 7-最后或出价/询问功能
  • 8-中点函数
我的问题是如何在代码中设置触发器方法?在我看来,我应该添加类似于
order.triggermethod=1
?谢谢你的帮助