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


Python Order.m_allOrNone方法代码示例

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


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

示例1: processMsg

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

#.........这里部分代码省略.........
         if version >= 5:
             order.m_goodAfterTime = self.readStr()
         if version >= 6:
             self.readStr()
         if version >= 7:
             order.m_faGroup = self.readStr()
             order.m_faMethod = self.readStr()
             order.m_faPercentage = self.readStr()
             order.m_faProfile = self.readStr()
         if version >= 8:
             order.m_goodTillDate = self.readStr()
         if version >= 9:
             order.m_rule80A = self.readStr()
             order.m_percentOffset = self.readDouble()
             order.m_settlingFirm = self.readStr()
             order.m_shortSaleSlot = self.readInt()
             order.m_designatedLocation = self.readStr()
             if (self.m_parent.serverVersion() == 51):
                 self.readInt()
             else:
                 if version >= 23:
                     order.m_exemptCode = self.readInt()
             order.m_auctionStrategy = self.readInt()
             order.m_startingPrice = self.readDouble()
             order.m_stockRefPrice = self.readDouble()
             order.m_delta = self.readDouble()
             order.m_stockRangeLower = self.readDouble()
             order.m_stockRangeUpper = self.readDouble()
             order.m_displaySize = self.readInt()
             if version < 18:
                 self.readBoolFromInt()
             order.m_blockOrder = self.readBoolFromInt()
             order.m_sweepToFill = self.readBoolFromInt()
             order.m_allOrNone = self.readBoolFromInt()
             order.m_minQty = self.readInt()
             order.m_ocaType = self.readInt()
             order.m_eTradeOnly = self.readBoolFromInt()
             order.m_firmQuoteOnly = self.readBoolFromInt()
             order.m_nbboPriceCap = self.readDouble()
         if version >= 10:
             order.m_parentId = self.readInt()
             order.m_triggerMethod = self.readInt()
         if version >= 11:
             order.m_volatility = self.readDouble()
             order.m_volatilityType = self.readInt()
             if (version == 11):
                 receivedInt = self.readInt()
                 order.m_deltaNeutralOrderType = "NONE" if (receivedInt == 0) else "MKT"
             else:
                 order.m_deltaNeutralOrderType = self.readStr()
                 order.m_deltaNeutralAuxPrice = self.readDouble()
             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.readDouble()
         if version >= 14:
             order.m_basisPoints = self.readDouble()
             order.m_basisPointsType = self.readInt()
             contract.m_comboLegsDescrip = self.readStr()
         if version >= 15:
             if version >= 20:
                 order.m_scaleInitLevelSize = self.readIntMax()
                 order.m_scaleSubsLevelSize = self.readIntMax()
开发者ID:Jicheng-Yan,项目名称:ib-py,代码行数:70,代码来源:EReader.py

示例2: submitOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_allOrNone [as 别名]
    def submitOrder(self, order):
        if order.isInitial():

            ibContract = Contract()
            ibOrder = Order()

            ibContract.m_symbol = order.getInstrument()


            ibContract.m_secType = self.__marketOptions['assetType']
            ibContract.m_currency = self.__marketOptions['currency']
            ibContract.m_exchange = self.__marketOptions['routing']

            ibOrder.m_totalQuantity = order.getInstrumentTraits().roundQuantity(order.getQuantity())
            if order.getAction() == (broker.Order.Action.BUY or broker.Order.Action.BUY_TO_COVER):
                ibOrder.m_action = 'BUY'
            elif order.getAction() == broker.Order.Action.SELL:
                ibOrder.m_action = 'SELL'
            elif order.getAction() == broker.Order.Action.SELL_SHORT:
                ibOrder.m_action = 'SELL'

            if order.getType() == broker.Order.Type.MARKET:                
                if order.getFillOnClose():
                    ibOrder.m_orderType = 'MOC'
                else:
                    ibOrder.m_orderType = 'MKT'
            elif order.getType() == broker.Order.Type.LIMIT:
                ibOrder.m_orderType = 'LMT'
                ibOrder.m_lmtPrice = order.getInstrumentTraits().roundPrice(order.getLimitPrice())
            elif order.getType() == broker.Order.Type.STOP:
                ibOrder.m_orderType = 'STP'
                ibOrder.m_auxPrice = order.getInstrumentTraits().roundPrice(order.getStopPrice())
            elif order.getType() == broker.Order.Type.STOP_LIMIT:
                ibOrder.m_orderType = 'STP LMT'
                ibOrder.m_lmtPrice = order.getInstrumentTraits().roundPrice(order.getLimitPrice())
                ibOrder.m_auxPrice = order.getInstrumentTraits().roundPrice(order.getStopPrice())

            

            if order.getAllOrNone() == True:
                ibOrder.m_allOrNone = 1
            else:
                ibOrder.m_allOrNone = 0


            if order.getGoodTillCanceled() == True:
                ibOrder.m_tif = 'GTC'
            else:
                ibOrder.m_tif = 'DAY'

            self.__ib.placeOrder(self.__nextOrderId, ibContract, ibOrder)

            order.setSubmitted(self.__nextOrderId, datetime.datetime.now())
            
            self.__nextOrderId += 1

            self._registerOrder(order)
            # Switch from INITIAL -> SUBMITTED
            # IMPORTANT: Do not emit an event for this switch because when using the position interface
            # the order is not yet mapped to the position and Position.onOrderUpdated will get called.
            order.switchState(broker.Order.State.SUBMITTED)
        else:
            raise Exception("The order was already processed")
开发者ID:dailypips,项目名称:pyalgotrade,代码行数:65,代码来源:livebroker.py


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