当前位置: 首页>>代码示例>>Python>>正文


Python Contract.m_comboLegs方法代码示例

本文整理汇总了Python中ib.ext.Contract.Contract.m_comboLegs方法的典型用法代码示例。如果您正苦于以下问题:Python Contract.m_comboLegs方法的具体用法?Python Contract.m_comboLegs怎么用?Python Contract.m_comboLegs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ib.ext.Contract.Contract的用法示例。


在下文中一共展示了Contract.m_comboLegs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_008a

# 需要导入模块: from ib.ext.Contract import Contract [as 别名]
# 或者: from ib.ext.Contract.Contract import m_comboLegs [as 别名]
def test_008a(connection, options):
    c = Contract()
    c.m_exchange = 'IDEALPRO'
    c.m_symbol = 'MO'
    c.m_localSymbol = 'MO1C'
    c.m_secType = 'BAG'
    c.m_expiry = '200806'
    leg1 = ComboLeg()
    leg1.m_conId = 123
    leg1.m_ratio = 1
    leg1.m_exchange = 'ONE'
    leg1.m_action = 'SELL'
    leg2 = ComboLeg()
    leg2.m_conId = 125
    leg2.m_ratio = 100
    leg2.m_exchange = 'NYSE'
    leg2.m_action = 'BUY'
    c.m_comboLegs = [leg1, leg2]
    connection.reqMktData(1, c, generic_tick_keys, False)
开发者ID:TimonPeng,项目名称:pi314,代码行数:21,代码来源:api_coverage.py

示例2: processMsg

# 需要导入模块: from ib.ext.Contract import Contract [as 别名]
# 或者: from ib.ext.Contract.Contract import m_comboLegs [as 别名]

#.........这里部分代码省略.........
             order.m_eTradeOnly = self.readBoolFromInt()
             order.m_firmQuoteOnly = self.readBoolFromInt()
             order.m_nbboPriceCap = self.readDoubleMax()
         if version >= 10:
             order.m_parentId = self.readInt()
             order.m_triggerMethod = self.readInt()
         if version >= 11:
             order.m_volatility = self.readDoubleMax()
             order.m_volatilityType = self.readInt()
             if version == 11:
                 receivedInt = self.readInt()
                 order.m_deltaNeutralOrderType = ("NONE" if (receivedInt == 0) else "MKT")
             else:
                 #  version 12 and up
                 order.m_deltaNeutralOrderType = self.readStr()
                 order.m_deltaNeutralAuxPrice = self.readDoubleMax()
                 if version >= 27 and not Util.StringIsEmpty(order.m_deltaNeutralOrderType):
                     order.m_deltaNeutralConId = self.readInt()
                     order.m_deltaNeutralSettlingFirm = self.readStr()
                     order.m_deltaNeutralClearingAccount = self.readStr()
                     order.m_deltaNeutralClearingIntent = self.readStr()
             order.m_continuousUpdate = self.readInt()
             if self.m_parent.serverVersion() == 26:
                 order.m_stockRangeLower = self.readDouble()
                 order.m_stockRangeUpper = self.readDouble()
             order.m_referencePriceType = self.readInt()
         if version >= 13:
             order.m_trailStopPrice = self.readDoubleMax()
         if version >= 30:
             order.m_trailingPercent = self.readDoubleMax()
         if version >= 14:
             order.m_basisPoints = self.readDoubleMax()
             order.m_basisPointsType = self.readIntMax()
             contract.m_comboLegsDescrip = self.readStr()
         if version >= 29:
             comboLegsCount = self.readInt()
             if comboLegsCount > 0:
                 contract.m_comboLegs = []
                 i = 0
                 while i < comboLegsCount:
                     conId = self.readInt()
                     ratio = self.readInt()
                     action = self.readStr()
                     exchange = self.readStr()
                     openClose = self.readInt()
                     shortSaleSlot = self.readInt()
                     designatedLocation = self.readStr()
                     exemptCode = self.readInt()
                     comboLeg = ComboLeg(conId, ratio, action, exchange, openClose, shortSaleSlot, designatedLocation, exemptCode)
                     contract.m_comboLegs.append(comboLeg)
                     i += 1
             orderComboLegsCount = self.readInt() 
             if orderComboLegsCount > 0:
                 order.m_orderComboLegs = []
                 i = 0
                 while i < orderComboLegsCount:
                     price = self.readDoubleMax()
                     orderComboLeg = OrderComboLeg(price)
                     order.m_orderComboLegs.append(orderComboLeg)
                     i += 1
         if version >= 26:
             smartComboRoutingParamsCount = self.readInt()
             if smartComboRoutingParamsCount > 0:
                 order.m_smartComboRoutingParams = []
                 i = 0
                 while i < smartComboRoutingParamsCount:
开发者ID:CarterBain,项目名称:Medici,代码行数:70,代码来源:EReader.py

示例3: ComboLeg

# 需要导入模块: from ib.ext.Contract import Contract [as 别名]
# 或者: from ib.ext.Contract.Contract import m_comboLegs [as 别名]
  
for conId in contractIds:
    leg = ComboLeg()
    leg.m_conId = conId
    leg.m_ratio = 1
    leg.m_action = "BUY"
    leg.m_exchange = "SMART"
     
    legs.append(leg)
 
#-------- create a contract with required legs
contract = Contract()
 
contract.m_symbol = "USD"   
contract.m_secType = "BAG"  
contract.m_exchange = "SMART"
contract.m_currency = "USD"
contract.m_comboLegs = legs
 
#----- create and place order
print('Placing order')
order = createOrder(orderId,shares=1) # create order
  
tws.placeOrder(orderId, contract, order) # place order
  
 
sleep(1) # wait before disconnecting  
 
print('All done')
  
tws.disconnect()
开发者ID:aborodya,项目名称:trading-with-python,代码行数:33,代码来源:ib_combiOrders.py


注:本文中的ib.ext.Contract.Contract.m_comboLegs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。