本文整理汇总了Python中ib.ext.Order.Order.m_minQty方法的典型用法代码示例。如果您正苦于以下问题:Python Order.m_minQty方法的具体用法?Python Order.m_minQty怎么用?Python Order.m_minQty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ib.ext.Order.Order
的用法示例。
在下文中一共展示了Order.m_minQty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_order
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [as 别名]
def make_order(limit_price):
order = Order()
order.m_minQty = 100
order.m_lmtPrice = limit_price
order.m_orderType = 'MKT'
order.m_totalQuantity = 100
order.m_action = 'BUY'
return order
示例2: makeStkOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [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
示例3: make_order
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [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
示例4: addOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [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
示例5: makeFutOrder
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [as 别名]
def makeFutOrder(type, action, orderId=-99, price=None):
order = Order()
order.m_orderId = orderId
order.m_clientId = 0
order.m_permid = 0
order.m_orderType = type
order.m_action = action
order.m_minQty = 1
order.m_totalQuantity = 1
# order.m_transmit = False
if type == 'LMT':
order.m_lmtPrice = price
if action == 'SELL':
pass
return order
示例6: processMsg
# 需要导入模块: from ib.ext.Order import Order [as 别名]
# 或者: from ib.ext.Order.Order import m_minQty [as 别名]
#.........这里部分代码省略.........
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()
else: