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


Python Order.Order类代码示例

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


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

示例1: create_order

 def create_order(self, account, orderType, totalQuantity, action):
     order = Order()
     order.m_account = account
     order.m_orderType = orderType
     order.m_totalQuantity = totalQuantity
     order.m_action = action
     return order
开发者ID:anthonyng2,项目名称:ib,代码行数:7,代码来源:IBWrapper.py

示例2: create_order

 def create_order(self, order_type, quantity, action):
     """ Create an Order Object to pair with the Contract Object
     """
     order = Order()
     order.m_orderType = order_type # 'MKT'/'LMT'
     order.m_totalQuantity = quantity # Integer
     order.m_action = action # 'BUY'/'SELL'
     return order
开发者ID:danbob123,项目名称:pythonSystemDev,代码行数:8,代码来源:ib_execution.py

示例3: create_stock_order

 def create_stock_order(self, quantity, is_buy, is_market_order=False):
     order = Order()
     order.m_totalQuantity = quantity
     order.m_orderType = \
         DataType.ORDER_TYPE_MARKET if is_market_order else \
             DataType.ORDER_TYPE_LIMIT
     order.m_action = \
         DataType.ORDER_ACTION_BUY if is_buy else \
             DataType.ORDER_ACTION_SELL
     return order
开发者ID:ssg100,项目名称:ibpython,代码行数:10,代码来源:ibframework.py

示例4: mkOrder

def mkOrder(id,shares, limit=None, account='',transmit=0, tif = 'DAY'):
	''' 
	create order object 
	
	Parameters
	-----------
	orderId : The order Id. You must specify a unique value. 
			  When the order status returns, it will be identified by this tag. 
			  This tag is also used when canceling the order.

	shares: number of shares to buy or sell. Negative for sell order.  
	limit : price limit, None for MKT order
	transmit: transmit immideatelly from tws
	'''

	action = {-1:'SELL',1:'BUY'}	
	
	o = Order()
	
	o.m_orderId = id
	o.m_account=account
	o.m_action = action[cmp(shares,0)]
	o.m_totalQuantity = abs(shares)
	o.m_transmit = transmit
	
	if limit is not None:
		o.m_orderType = 'LMT'
		o.m_lmtPrice = limit
	else:
		o.m_orderType = 'MKT'
	
	return o
开发者ID:hezhenke,项目名称:myIbPy,代码行数:32,代码来源:cat.py

示例5: close

            def close(orderty = "MKT", price = None, timeout = None):
                position = self["position"]
                order = Order()
                if position > 0:
                    order.m_action = "SELL"
                else:
                    order.m_action = "BUY"
                order.m_tif = "DAY"
                order.m_orderType = orderty
                order.m_totalQuantity = abs(position)
                order.m_openClose = "C"
                if price <> None: order.m_lmtPrice = price

                if price == None and orderty <> "MKT": order.m_lmtPrice = self.best_price(position)
                
                if timeout == None:
                    oid = self.con.placeOrder(self.contract, order, None)
                    self.oids.append(oid)
                    return oid
                else:
                    oid = self.con.placeOrder(self.contract, order, timedelta(seconds=timeout))
                    if oid == None:
                        return None
                    else:
                        self.oids.append(oid)
                        return oid
开发者ID:dm04806,项目名称:systemn,代码行数:26,代码来源:contract.py

示例6: create_order

    def create_order(self, order_type, quantity, action):
        """Create an Order object (Market/Limit) to go long/short.

        order_type - 'MKT', 'LMT' for Market or Limit orders
        quantity - Integral number of assets to order
        action - 'BUY' or 'SELL'"""
        order = Order()
        order.m_orderType = order_type
        order.m_totalQuantity = quantity
        order.m_action = action
        return order
开发者ID:joriscram,项目名称:qsforex,代码行数:11,代码来源:execution.py

示例7: create_order

    def create_order(self, order_type, quantity, action):
        ''' Create an Order object (Market/Limit) to go long/short.

        order_type - 'MKT', 'LMT' for market or limit orders
        quantity - integer number of units to order
        action - 'BUY' or 'SELL'
        '''
        order = Order()
        order.m_orderType = order_type
        order.m_totalQuantity = quantity
        order.m_action = action
        return order
开发者ID:jgerardsimcock,项目名称:ml4t,代码行数:12,代码来源:interactive_broker_wrapper.py

示例8: create_order

def create_order(data):
	if isinstance(data, dict):
		try:
			order = Order()
			order.m_orderType = data['type']
			order.m_totalQuantity = data['quantity']
			order.m_action = data['action']
			return order
		except:
			raise ValueError
	else:
		raise TypeError	
开发者ID:hestinr12,项目名称:simple_algo_trading,代码行数:12,代码来源:contract.py

示例9: createOrder

def createOrder(orderId, shares, limit=None, transmit=0):
    """ 
    create order object 
    
    Parameters
    -----------
    orderId : The order Id. You must specify a unique value. 
              When the order status returns, it will be identified by this tag. 
              This tag is also used when canceling the order.

    shares: number of shares to buy or sell. Negative for sell order.  
    limit : price limit, None for MKT order
    transmit: transmit immideatelly from tws
    """

    action = {-1: "SELL", 1: "BUY"}

    o = Order()

    o.m_orderId = orderId
    o.m_action = action[cmp(shares, 0)]
    o.m_totalQuantity = abs(shares)
    o.m_transmit = transmit

    if limit is not None:
        o.m_orderType = "LMT"
        o.m_lmtPrice = limit
    else:
        o.m_orderType = "MKT"

    return o
开发者ID:frrp,项目名称:trading-with-python,代码行数:31,代码来源:ib_placeOrder.py

示例10: placeOrder

 def placeOrder(self,symbol,shares,limit=None,account='U8830832',exchange='SMART', transmit=0):
     ''' place an order on already subscribed contract '''
     
     
     if symbol not in self.contracts.keys():
         self.log.error("Can't place order, not subscribed to %s" % symbol)
         return
     
     action = {-1:'SELL',1:'BUY'}
     
     o= Order()
     o.m_orderId = self.getOrderId()
     o.m_action = action[cmp(shares,0)]
     o.m_totalQuantity = abs(shares)
     o.m_account = account
     o.m_transmit = transmit
     
     if limit is not None:
         o.m_orderType = 'LMT'
         o.m_lmtPrice = limit
     
     self.log.debug('Placing %s order for %i %s (id=%i)' % (o.m_action,o.m_totalQuantity,symbol,o.m_orderId))
     
         
     self.tws.placeOrder(o.m_orderId,self.contracts[symbol],o)   
开发者ID:hezhenke,项目名称:myIbPy,代码行数:25,代码来源:interactivebrokers.py

示例11: order

            def order(position = "BUY", orderty = "MKT", quantity = 100, price = None, timeout = None, openClose = "O"):
                order = Order()
                order.m_action = position
                order.m_tif = "DAY"
                order.m_orderType = orderty
                order.m_totalQuantity = quantity
                order.m_openClose = openClose
                if price <> None: order.m_lmtPrice = price

                if position == "BUY":
                    pos = quantity
                else:
                    pos = -quantity

                if price == None and orderty <> "MKT": order.m_lmtPrice = self.best_price(pos)
                
                if timeout == None:
                    oid = self.con.placeOrder(self.contract, order, None)
                    self.oids.append(oid)
                    
                    return oid
                else:
                    oid = self.con.placeOrder(self.contract, order, timedelta(seconds=timeout))
                    if oid == None:
                        return None
                    else:
                        self.oids.append(oid)
                        return oid
开发者ID:dm04806,项目名称:systemn,代码行数:28,代码来源:contract.py

示例12: create_order

    def create_order(self, order_type, quantity, action):
        """
        Creates the second component of the pair, the Order object
        (Market/Limit) to go long/short.

        Parameters
            order_type - 'MKT' or 'LMT' for Market or Limit orders respectively
            quantity - An integral number of assets to order
            action - 'BUY' or 'SELL'
        """

        order = Order()
        order.m_orderType = order_type
        order.m_totalQuantity = quantity
        order.m_action = action
        return order
开发者ID:lulzzz,项目名称:AlgoTradingPlatform_Beta,代码行数:16,代码来源:ib_execution.py

示例13: make_order

def make_order(action, quantity, price = None):
	if price is not None:
		order = Order()
		order.m_orderType = 'LMT'
		order.m_totalQuantity = quantity
		order.m_action = action
		order.m_lmtPrice = price
	else:
		order = Order()
		order.m_orderType = 'MKT'
		order.m_totalQuantity = quantity
		order.m_action = action
	return order
开发者ID:TimonPeng,项目名称:pi314,代码行数:13,代码来源:testIbPy.py

示例14: create_order

    def create_order(self, order_type, quantity, action):
        """
        Create an Order object (Market/Limit) to go long/short.

        Parameters:
            order_type = "MKT", "LMT" for Market or Limit orders
            quantity - Integral number of assets to order
            action - "BUY" or "SELL"

        Note:
            This method generates the second component of the Contract/Order pair. It expects an order type (e.g., market or limit), a quantity to trade and an "action" (buy or sell).
        """
        order = Order()
        order.m_orderType = order_type
        order.m_totalQuantity = quantity
        order.m_action = action
        return order
开发者ID:MrPeterLee,项目名称:FincLab,代码行数:17,代码来源:execution_ib.py

示例15: make_order

def make_order(qty, limit_price, action):
    order = Order()
    order.m_minQty = qty
    order.m_lmtPrice = limit_price
    order.m_orderType = 'LMT'
    order.m_totalQuantity = qty
    order.m_action = action
    order.m_tif = 'GTC'
    order.m_outsideRth = True
    return order
开发者ID:cjastram,项目名称:silverbot,代码行数:10,代码来源:tws-trader.py


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