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


Python Order.m_transmit方法代码示例

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


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

示例1: placeOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
    def placeOrder(self, symbol, shares, limit=None, 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_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:reprior123,项目名称:TraderSoftwareRP,代码行数:29,代码来源:new+apidataget+longone.py

示例2: createOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
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[sign(shares)]
    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:aborodya,项目名称:trading-with-python,代码行数:33,代码来源:ib_placeOrder.py

示例3: create_order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def create_order(order_type, quantity, action, limitprice, transmitf, auxprice, stopprice, rptype):
    order = Order()
    order.m_action = action
    order.m_totalQuantity = quantity
    order.m_transmit = transmitf
    order.m_orderType = order_type
    if order_type == 'LMT':
        order.m_lmtPrice = limitprice
        pass
    elif order_type  == 'STP':
        order.m_stpPrice = stopprice
        pass
    else:
        print'failing on price...need one'
    return order
#####################
##if ordernumx == 'filled':
##    launch profittake and stopbracket with ocaGroup
##reqIds()
##orderStatus()
##ParentID
##ocaType
##ocaGroup
###############################
##datahandler for snapshots
##reqmktdata live data
##req live recent bars
##PlaceOrder(entryorder)
##if entryorder filled:
##    PlaceOrder(profitorder)
##    get orderid
##    PlaceOrder(profitorder by number, transmit)
##    PlaceOrder(stopbracket) # with transmit true 
    '''
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:36,代码来源:ibutiles+TESTLIVE+pauser.py

示例4: makeOptOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def makeOptOrder(action, orderID, tif, orderType):
    newOptOrder = Order()
    newOptOrder.m_orderId = orderID
    newOptOrder.m_clientId = 0
    newOptOrder.m_permid = 0
    newOptOrder.m_action = action
    newOptOrder.m_lmtPrice = 0
    newOptOrder.m_auxPrice = 0
    newOptOrder.m_tif = tif
    newOptOrder.m_transmit = False
    newOptOrder.m_orderType = orderType
    newOptOrder.m_totalQuantity = 1
    return newOptOrder
开发者ID:Jicheng-Yan,项目名称:ib-py,代码行数:15,代码来源:option_order_data.py

示例5: order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
    def order(self, sid, amount, limit_price, stop_price, order_id=None):
        id = super(LiveBlotter, self).order(sid, amount, limit_price, stop_price, order_id=None)
        order_obj = self.orders[id]

        ib_order = IBOrder()
        ib_order.m_transmit = True
        ib_order.m_orderRef = order_obj.id
        ib_order.m_totalQuantity = order_obj.amount
        ib_order.m_action = ["BUY" if ib_order.m_totalQuantity > 0 else "SELL"][0]
        ib_order.m_tif = "DAY"
        # Todo: make the FA params configurable
        ib_order.m_faGroup = "ALL"
        ib_order.m_faMethod = "AvailableEquity"

        # infer order type
        if order_obj.stop and not order_obj.limit:
            ib_order.m_orderType = "STP"
            ib_order.m_auxPrice = float(order_obj.stop)

        elif order_obj.limit and not order_obj.stop:
            ib_order.m_orderType = "LMT"
            ib_order.m_lmtPrice = float(order_obj.limit)

        elif order_obj.stop and order_obj.limit:
            ib_order.m_orderType = "STPLMT"
            ib_order.m_auxPrice = float(order_obj.stop)
            ib_order.m_lmtPrice = float(order_obj.limit)

        else:
            ib_order.m_orderType = "MKT"

        contract = Contract()
        contract.m_symbol = order_obj.sid
        contract.m_currency = "USD"

        if hasattr(order_obj, "contract"):
            # This is a futures contract
            contract.m_secType = "FUT"
            contract.m_exchange = "GLOBEX"
            contract.m_expiry = order_obj.contract

        else:
            # This is a stock
            contract.m_secType = "STK"
            contract.m_exchange = "SMART"

        ib_id = self.place_order(contract, ib_order)
        self.id_map[order_obj.id] = ib_id

        return order_obj.id
开发者ID:martinkirov,项目名称:AlephNull,代码行数:52,代码来源:broker.py

示例6: create_order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def create_order(order_type, quantity, action, limitprice, transmitf, auxprice, stopprice, rptype):
    order = Order()
    order.m_orderType = order_type
    order.m_totalQuantity = quantity
    order.m_action = action
    order.m_lmtPrice = limitprice
    order.m_transmit = transmitf
    if rptype == 'profittake':
        pass
    if rptype == 'stopbracket':
        pass    
    return order
#####################
##if ordernumx == 'filled':
##    launch profittake and stopbracket with ocaGroup
    pass
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:18,代码来源:ibutiles+TESTLIVE.py

示例7: newOrder_GUI

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def newOrder_GUI(action, orderID, quantity,startTime):
    global trade_params
    
    newStkOrder = Order()
    print orderID, action, trade_params['OrderTIF'],trade_params['OrderType'],quantity,trade_params['Account'],startTime
    newStkOrder.m_orderId = orderID
    
    newStkOrder.m_action = action
    newStkOrder.m_tif = 'DAY'
    newStkOrder.m_transmit = True
    newStkOrder.m_orderType = 'MKT'
    newStkOrder.m_totalQuantity = quantity
    newStkOrder.m_account = 'DU164541'
    newStkOrder.m_goodAfterTime = startTime
    #newStkOrder.m_goodAfterTime=endTime
    return newStkOrder
开发者ID:jc3939,项目名称:My-Work-During-Internship,代码行数:18,代码来源:IB_GUI.py

示例8: addmktorder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def addmktorder(cid, action, qty):
    id = len(orders)
    o = Order()
    o.m_orderId = id
    o.m_clientId = 0
    o.m_permid = 0
    o.m_action = action
    o.m_lmtPrice = 0
    o.m_auxPrice = 0
    o.m_tif = 'DAY'
    o.m_orderType = 'MKT'
    o.m_totalQuantity = qty
    o.m_transmit = True
    orders.append([o, cid, qty, id])        
    con.placeOrder(id, contracts[cid], o)
    position(cid)
    pending(cid)
开发者ID:dm04806,项目名称:systemn,代码行数:19,代码来源:test.py

示例9: create_order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
def create_order(order_type, quantity, action, limitprice, transmitf, auxprice, stopprice, rptype):
    order = Order()
    order.m_orderType = order_type
    order.m_totalQuantity = quantity
    order.m_action = action
    order.m_lmtPrice = limitprice
    order.m_transmit = transmitf
    order.m_faGroup = 'rpacct'
##    order.m_faProfile = 'allocateALL'
    order.m_faMethod = 'AvailableEquity'
    if order_type == 'LMT':
        pass
##        order.m_lmtPrice = limitprice
    elif order_type  == 'STP':
        order.m_auxPrice = stopprice
    else:
        print'failing on price in ibutiles..bad order type...need one'
    return order
开发者ID:reprior123,项目名称:TraderSoftwareRP,代码行数:20,代码来源:ibutiles+-+Copy.py

示例10: placeOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
 def placeOrder(self,contract, shares,limit = None, transmit=0):
     ''' 
     create order object 
  
     Parameters
     -----------
     
     shares: number of shares to buy or sell. Negative for sell order.  
     limit : price limit, None for MKT order
     transmit: transmit immideatelly from tws
     
     Returns: 
     -----------
     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.
  
     
     '''
  
     action = {-1:'SELL',1:'BUY'}  
     
     
     orderId = self.nextValidOrderId
     self.nextValidOrderId += 1 # increment  
     
     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'
  
     # place order
     self.tws.placeOrder(orderId, contract, o) # place order     
  
  
     return orderId
开发者ID:Kevin-Prichard,项目名称:trading-with-python,代码行数:45,代码来源:handlers.py

示例11: makeOrder

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
    def makeOrder(self, action, orderId, tif, orderType, price, transmit, parentId):
        newOrder = Order()
        newOrder.m_orderId = orderId
        newOrder.m_transmit = transmit
        newOrder.m_lmtPrice = price
        newOrder.m_tif = tif
        newOrder.m_action = action
        newOrder.m_orderType = orderType
        if parentId is not None:
            newOrder.m_parentId = parentId

        newOrder.m_hidden = False
        newOrder.m_outsideRth = True
        newOrder.m_clientId = 999
        newOrder.m_permid = 0
        if orderType == 'LMT':
            newOrder.m_auxPrice = 0
        elif orderType == 'STP' or orderType == 'MIT':
            newOrder.m_auxPrice = price
        newOrder.m_totalQuantity = 1
        
        return newOrder
开发者ID:chicagohawk,项目名称:TwitterAutoTrade,代码行数:24,代码来源:iblib.py

示例12: sleep

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_transmit [as 别名]
#   symbol_id = symbol_id + 1
#   sleep(0.5)
#
# print dataDownload

from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.opt import ibConnection, message
from time import sleep

def watchAll(msg):
    print(msg)

con = ibConnection()
con.registerAll(watchAll)
con.connect()
sleep(1)

fx = Contract()
fx.m_secType = "CASH"
fx.m_symbol = "USD"
fx.m_currency = "CAD"
fx.m_exchange = "IDEALPRO"
con.reqMktData(1,fx,"",False)

ord = Order()
ord.m_orderType = 'MKT'
ord.m_totalQuantity = 100000
ord.m_action = 'BUY'
ord.m_transmit = False
con.placeOrder(1234,fx,ord)
开发者ID:joriscram,项目名称:qsforex,代码行数:33,代码来源:historic.py


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