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


Python Order.m_faGroup方法代码示例

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


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

示例1: order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_faGroup [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

示例2: create_order

# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_faGroup [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

示例3: processMsg

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

#.........这里部分代码省略.........
         contract.m_expiry = self.readStr()
         contract.m_strike = self.readDouble()
         contract.m_right = self.readStr()
         contract.m_exchange = self.readStr()
         contract.m_currency = self.readStr()
         if version >= 2:
             contract.m_localSymbol = self.readStr()
         order.m_action = self.readStr()
         order.m_totalQuantity = self.readInt()
         order.m_orderType = self.readStr()
         order.m_lmtPrice = self.readDouble()
         order.m_auxPrice = self.readDouble()
         order.m_tif = self.readStr()
         order.m_ocaGroup = self.readStr()
         order.m_account = self.readStr()
         order.m_openClose = self.readStr()
         order.m_origin = self.readInt()
         order.m_orderRef = self.readStr()
         if version >= 3:
             order.m_clientId = self.readInt()
         if version >= 4:
             order.m_permId = self.readInt()
             if version < 18:
                 self.readBoolFromInt()
             else:
                 order.m_outsideRth = self.readBoolFromInt()
             order.m_hidden = (self.readInt() == 1)
             order.m_discretionaryAmt = self.readDouble()
         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()
开发者ID:Jicheng-Yan,项目名称:ib-py,代码行数:70,代码来源:EReader.py


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