本文整理汇总了Python中ib.ext.Order.Order.m_outsideRth方法的典型用法代码示例。如果您正苦于以下问题:Python Order.m_outsideRth方法的具体用法?Python Order.m_outsideRth怎么用?Python Order.m_outsideRth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ib.ext.Order.Order
的用法示例。
在下文中一共展示了Order.m_outsideRth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeStkOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [as 别名]
def makeStkOrder(shares,action,account,ordertype='MKT'):
order = Order()
order.m_minQty = shares
order.m_orderType = ordertype
order.m_totalQuantity = shares
order.m_action = str(action).upper()
order.m_outsideRth = True #allow order to be filled ourside regular trading hours
order.m_account = account
return order
示例2: make_order
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [as 别名]
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
示例3: addOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [as 别名]
def addOrder(
self,
symbol,
lmtPrice=0,
minQty=100,
action="BUY",
orderType="LMT",
tif="DAY",
outsideRTH=False,
totalQuantity=False,
):
"""Generate and store an order for the given symbol"""
validAction = ["BUY", "SELL", "SSHORT"]
if action not in validAction:
raise Exception(
"{0} is not a valid order action. " + "Valid actions are: {1}.".format(action, ", ".join(validAction))
)
validType = [
"LMT",
"MKT",
"MKTCLS",
"LMTCLS",
"PEGMKT",
"SCALE",
"STP",
"STPLMT",
"TRAIL",
"REL",
"VWAP",
"TRAILLIMIT",
]
if orderType not in validType:
raise Exception(
"{0} is not a valid order type. " + "Valid types are: {1}.".format(orderType, ", ".join(validType))
)
validTIF = ["DAY", "GTC", "IOC", "GTD"]
if tif not in validTIF:
raise Exception("{0} is not a valid TIF." + "Valid TIFs are: {1}.".format(tif, ", ".join(validTIF)))
o = Order()
o.m_minQty = minQty
o.m_totalQuantity = totalQuantity if totalQuantity else minQty
o.m_lmtPrice = lmtPrice
o.m_action = action
o.m_tif = tif
o.m_orderType = orderType
o.m_outsideRth = outsideRTH
self._orders[symbol] = self._next_valid_id, o
self._next_valid_id += 1
return self._next_valid_id - 1
示例4: create_stock_order
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [as 别名]
def create_stock_order(order_id, quantity, is_buy, price=None, stop_price=None):
order = Order()
order.m_outsideRth = True
order.m_orderId = order_id
order.m_totalQuantity = quantity
order.m_action = DataType.ORDER_ACTION_BUY if is_buy else DataType.ORDER_ACTION_SELL
if price is None:
order.m_orderType = DataType.ORDER_TYPE_MARKET
else:
order.m_lmtPrice = price
order.m_orderType = DataType.ORDER_TYPE_LIMIT
if stop_price is not None:
order.m_auxPrice = stop_price
order.m_orderType = DataType.ORDER_TYPE_STOP_LIMIT
return order
示例5: makeOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [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
示例6: processMsg
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_outsideRth [as 别名]
#.........这里部分代码省略.........
version = self.readInt()
order = Order()
order.m_orderId = self.readInt()
contract = Contract()
if version >= 17:
contract.m_conId = self.readInt()
contract.m_symbol = self.readStr()
contract.m_secType = self.readStr()
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: