Added:
trunk/ib/ext/TagValue.py
trunk/ib/ext/cfg/TagValue.py
Modified:
trunk/demo/api_coverage
trunk/ib/ext/Contract.py
trunk/ib/ext/ContractDetails.py
trunk/ib/ext/EClientSocket.py
trunk/ib/ext/EReader.py
trunk/ib/ext/EWrapper.py
trunk/ib/ext/EWrapperMsgGenerator.py
trunk/ib/ext/Order.py
trunk/ib/ext/Util.py
trunk/ib/ext/cfg/Contract.py
trunk/ib/ext/cfg/EClientSocket.py
Log:
Initial support for API version 9.60.
Modified: trunk/demo/api_coverage
==============================================================================
--- trunk/demo/api_coverage (original)
+++ trunk/demo/api_coverage Mon Jan 26 11:44:03 2009
@@ -197,7 +197,7 @@
connection.reqAllOpenOrders()
connection.reqAutoOpenOrders(True)
connection.reqOpenOrders()
- connection.reqExecutions(exec_filter(options.clientid))
+ connection.reqExecutions(0, exec_filter(options.clientid))
def test_005(connection, options):
@@ -265,7 +265,7 @@
pass
connection.register(cb, 'ExecDetails')
filtr = exec_filter(options.clientid)
- connection.reqExecutions(filtr)
+ connection.reqExecutions(1, filtr)
c = Contract()
c.m_symbol = 'GOOG'
c.m_secType = 'OPT'
Modified: trunk/ib/ext/Contract.py
==============================================================================
--- trunk/ib/ext/Contract.py (original)
+++ trunk/ib/ext/Contract.py Mon Jan 26 11:44:03 2009
@@ -39,6 +39,7 @@
@overloaded
def __init__(self):
+ self.comboLegs = []
self.m_conId = 0
self.m_strike = 0
self.m_includeExpired = False
@@ -84,8 +85,6 @@
l_theOther = p_other
if (self.m_conId != l_theOther.m_conId):
return False
- if (len(self.m_comboLegs) != len(l_theOther.m_comboLegs)):
- return False
if (Util.StringCompare(self.m_secType, l_theOther.m_secType) != 0):
return False
if (Util.StringCompare(self.m_symbol, l_theOther.m_symbol) != 0)
or (Util.StringCompare(self.m_exchange, l_theOther.m_exchange) != 0) or
(Util.StringCompare(self.m_primaryExch, l_theOther.m_primaryExch) != 0) or
(Util.StringCompare(self.m_currency, l_theOther.m_currency) != 0):
@@ -95,25 +94,8 @@
return False
if (Util.StringCompare(self.m_expiry, l_theOther.m_expiry) !=
0) or (Util.StringCompare(self.m_right, l_theOther.m_right) != 0) or
(Util.StringCompare(self.m_multiplier, l_theOther.m_multiplier) != 0) or
(Util.StringCompare(self.m_localSymbol, l_theOther.m_localSymbol) != 0):
return False
- if len(self.m_comboLegs) > 0:
- comboLegsSize = len(self.m_comboLegs)
- alreadyMatchedSecondLeg = [bool() for __idx0 in
range(comboLegsSize)]
- ## for-while
- ctr1 = 0
- while ctr1 < comboLegsSize:
- l_thisComboLeg = self.m_comboLegs[ctr1]
- ctr2 = 0
- ## for-while
- while ctr2 < comboLegsSize:
- if alreadyMatchedSecondLeg[ctr2]:
- continue
- if l_thisComboLeg == l_theOther.m_comboLegs[ctr2]:
- alreadyMatchedSecondLeg[ctr2] = True
- break
- ctr2 += 1
- if ctr2 >= comboLegsSize:
- return False
- ctr1 += 1
+ if not Util.VectorEqualsUnordered(self.m_comboLegs,
l_theOther.m_comboLegs):
+ return False
if (self.m_underComp != l_theOther.m_underComp):
if self.m_underComp is None or l_theOther.m_underComp is None:
return False
Modified: trunk/ib/ext/ContractDetails.py
==============================================================================
--- trunk/ib/ext/ContractDetails.py (original)
+++ trunk/ib/ext/ContractDetails.py Mon Jan 26 11:44:03 2009
@@ -27,6 +27,7 @@
m_priceMagnifier = 0
m_orderTypes = ""
m_validExchanges = ""
+ m_underConId = 0
m_cusip = ""
m_ratings = ""
m_descAppend = ""
@@ -47,19 +48,22 @@
def __init__(self):
self.m_summary = Contract()
self.m_minTick = 0
+ self.m_underConId = 0
- @__init__.register(object, Contract, str, str, float, str, str)
+ @__init__.register(object, Contract, str, str, float, str, str, int)
def __init___0(self, p_summary,
p_marketName,
p_tradingClass,
p_minTick,
p_orderTypes,
- p_validExchanges):
+ p_validExchanges,
+ p_underConId):
self.m_summary = p_summary
self.m_marketName = p_marketName
self.m_tradingClass = p_tradingClass
self.m_minTick = p_minTick
self.m_orderTypes = p_orderTypes
self.m_validExchanges = p_validExchanges
+ self.m_underConId = p_underConId
Modified: trunk/ib/ext/EClientSocket.py
==============================================================================
--- trunk/ib/ext/EClientSocket.py (original)
+++ trunk/ib/ext/EClientSocket.py Mon Jan 26 11:44:03 2009
@@ -32,7 +32,7 @@
""" generated source for EClientSocket
"""
- CLIENT_VERSION = 38
+ CLIENT_VERSION = 42
SERVER_VERSION = 38
EOL = 0
BAG_SEC_TYPE = "BAG"
@@ -91,6 +91,8 @@
MIN_SERVER_VER_UNDER_COMP = 40
MIN_SERVER_VER_CONTRACT_DATA_CHAIN = 40
MIN_SERVER_VER_SCALE_ORDERS2 = 40
+ MIN_SERVER_VER_ALGO_ORDERS = 41
+ MIN_SERVER_VER_EXECUTION_DATA_CHAIN = 42
m_anyWrapper = None
m_dos = None
m_connected = bool()
@@ -606,7 +608,11 @@
if (order.m_scaleSubsLevelSize != Integer.MAX_VALUE):
self.error(id, EClientErrors.UPDATE_TWS, " It does not
support Subsequent Level Size for Scale orders.")
return
- VERSION = 26
+ if self.m_serverVersion < self.MIN_SERVER_VER_ALGO_ORDERS:
+ if not self.IsEmpty(order.m_algoStrategy):
+ self.error(id, EClientErrors.UPDATE_TWS, " It does not
support algo orders.")
+ return
+ VERSION = 27
try:
self.send(self.PLACE_ORDER)
self.send(VERSION)
@@ -743,6 +749,20 @@
self.send(underComp.m_price)
else:
self.send(False)
+ if self.m_serverVersion >= self.MIN_SERVER_VER_ALGO_ORDERS:
+ self.send(order.m_algoStrategy)
+ if not self.IsEmpty(order.m_algoStrategy):
+ algoParams = order.m_algoParams
+ algoParamsCount = 0 if algoParams is None else
len(algoParams)
+ self.send(algoParamsCount)
+ if algoParamsCount > 0:
+ ## for-while
+ i = 0
+ while i < algoParamsCount:
+ tagValue = algoParams[i]
+ self.send(tagValue.m_tag)
+ self.send(tagValue.m_value)
+ i += 1
if self.m_serverVersion >= self.MIN_SERVER_VER_WHAT_IF_ORDERS:
self.send(order.m_whatIf)
except (Exception, ), e:
@@ -766,14 +786,16 @@
self.close()
@synchronized(mlock)
- def reqExecutions(self, filter):
+ def reqExecutions(self, reqId, filter):
if not self.m_connected:
self.error(EClientErrors.NO_VALID_ID,
EClientErrors.NOT_CONNECTED, "")
return
- VERSION = 2
+ VERSION = 3
try:
self.send(self.REQ_EXECUTIONS)
self.send(VERSION)
+ if self.m_serverVersion >=
self.MIN_SERVER_VER_EXECUTION_DATA_CHAIN:
+ self.send(reqId)
if self.m_serverVersion >= 9:
self.send(filter.m_clientId)
self.send(filter.m_acctCode)
@@ -1072,6 +1094,6 @@
@classmethod
def IsEmpty(cls, strval):
- return not bool(strval)
+ return Util.StringIsEmpty(strval)
Modified: trunk/ib/ext/EReader.py
==============================================================================
--- trunk/ib/ext/EReader.py (original)
+++ trunk/ib/ext/EReader.py Mon Jan 26 11:44:03 2009
@@ -60,6 +60,10 @@
REAL_TIME_BARS = 50
FUNDAMENTAL_DATA = 51
CONTRACT_DATA_END = 52
+ OPEN_ORDER_END = 53
+ ACCT_DOWNLOAD_END = 54
+ EXECUTION_DATA_END = 55
+ DELTA_NEUTRAL_VALIDATION = 56
m_parent = None
m_dis = None
@@ -355,6 +359,20 @@
underComp.m_delta = self.readDouble()
underComp.m_price = self.readDouble()
contract.m_underComp = underComp
+ if version >= 21:
+ order.m_algoStrategy = self.readStr()
+ if not Util.StringIsEmpty(order.m_algoStrategy):
+ algoParamsCount = self.readInt()
+ if algoParamsCount > 0:
+ order.m_algoParams = Vector(algoParamsCount)
+ ## for-while
+ i = 0
+ while i < algoParamsCount:
+ tagValue = TagValue()
+ tagValue.m_tag = self.readStr()
+ tagValue.m_value = self.readStr()
+ order.m_algoParams.add(tagValue)
+ i += 1
orderState = OrderState()
if version >= 16:
order.m_whatIf = self.readBoolFromInt()
@@ -425,6 +443,8 @@
contract.m_validExchanges = self.readStr()
if version >= 2:
contract.m_priceMagnifier = self.readInt()
+ if version >= 4:
+ contract.m_underConId = self.readInt()
self.eWrapper().contractDetails(reqId, contract)
elif msgId == self.BOND_CONTRACT_DATA:
version = self.readInt()
@@ -461,6 +481,9 @@
self.eWrapper().bondContractDetails(reqId, contract)
elif msgId == self.EXECUTION_DATA:
version = self.readInt()
+ reqId = -1
+ if version >= 7:
+ reqId = self.readInt()
orderId = self.readInt()
contract = Contract()
if version >= 5:
@@ -491,7 +514,7 @@
if version >= 6:
exec_.m_cumQty = self.readInt()
exec_.m_avgPrice = self.readDouble()
- self.eWrapper().execDetails(orderId, contract, exec_)
+ self.eWrapper().execDetails(reqId, contract, exec_)
elif msgId == self.MARKET_DEPTH:
version = self.readInt()
id = self.readInt()
@@ -584,6 +607,25 @@
self.readInt()
reqId = self.readInt()
self.eWrapper().contractDetailsEnd(reqId)
+ elif msgId == self.OPEN_ORDER_END:
+ self.readInt()
+ self.eWrapper().openOrderEnd()
+ elif msgId == self.ACCT_DOWNLOAD_END:
+ self.readInt()
+ accountName = self.readStr()
+ self.eWrapper().accountDownloadEnd(accountName)
+ elif msgId == self.EXECUTION_DATA_END:
+ self.readInt()
+ reqId = self.readInt()
+ self.eWrapper().execDetailsEnd(reqId)
+ elif msgId == self.DELTA_NEUTRAL_VALIDATION:
+ self.readInt()
+ reqId = self.readInt()
+ underComp = UnderComp()
+ underComp.m_conId = self.readInt()
+ underComp.m_delta = self.readDouble()
+ underComp.m_price = self.readDouble()
+ self.eWrapper().deltaNeutralValidation(reqId, underComp)
else:
self.m_parent.error(EClientErrors.NO_VALID_ID,
EClientErrors.UNKNOWN_ID.code(), EClientErrors.UNKNOWN_ID.msg())
return False
Modified: trunk/ib/ext/EWrapper.py
==============================================================================
--- trunk/ib/ext/EWrapper.py (original)
+++ trunk/ib/ext/EWrapper.py Mon Jan 26 11:44:03 2009
@@ -66,6 +66,9 @@
def openOrder(self, orderId, contract, order, orderState):
raise NotImplementedError()
+ def openOrderEnd(self):
+ raise NotImplementedError()
+
def updateAccountValue(self, key, value, currency, accountName):
raise NotImplementedError()
@@ -82,6 +85,9 @@
def updateAccountTime(self, timeStamp):
raise NotImplementedError()
+ def accountDownloadEnd(self, accountName):
+ raise NotImplementedError()
+
def nextValidId(self, orderId):
raise NotImplementedError()
@@ -94,7 +100,10 @@
def contractDetailsEnd(self, reqId):
raise NotImplementedError()
- def execDetails(self, orderId, contract, execution):
+ def execDetails(self, reqId, contract, execution):
+ raise NotImplementedError()
+
+ def execDetailsEnd(self, reqId):
raise NotImplementedError()
def updateMktDepth(self, tickerId,
@@ -165,6 +174,9 @@
raise NotImplementedError()
def fundamentalData(self, reqId, data):
+ raise NotImplementedError()
+
+ def deltaNeutralValidation(self, reqId, underComp):
raise NotImplementedError()
Modified: trunk/ib/ext/EWrapperMsgGenerator.py
==============================================================================
--- trunk/ib/ext/EWrapperMsgGenerator.py (original)
+++ trunk/ib/ext/EWrapperMsgGenerator.py Mon Jan 26 11:44:03 2009
@@ -88,10 +88,28 @@
if contract.m_underComp is not None:
underComp = contract.m_underComp
msg += " underComp.conId =" + underComp.m_conId + "
underComp.delta =" + underComp.m_delta + " underComp.price =" +
underComp.m_price
+ if not Util.StringIsEmpty(order.m_algoStrategy):
+ msg += " algoStrategy=" + order.m_algoStrategy
+ msg += " algoParams={"
+ if order.m_algoParams is not None:
+ algoParams = order.m_algoParams
+ ## for-while
+ i = 0
+ while i < len(algoParams):
+ param = algoParams.elementAt(i)
+ if i > 0:
+ msg += ","
+ msg += param.m_tag + "=" + param.m_value
+ i += 1
+ msg += "}"
orderStateMsg = " status=" + orderState.m_status + " initMargin="
+ orderState.m_initMargin + " maintMargin=" + orderState.m_maintMargin + "
equityWithLoan=" + orderState.m_equityWithLoan + " commission=" +
Util.DoubleMaxString(orderState.m_commission) + " minCommission=" +
Util.DoubleMaxString(orderState.m_minCommission) + " maxCommission=" +
Util.DoubleMaxString(orderState.m_maxCommission) + " commissionCurrency=" +
orderState.m_commissionCurrency + " warningText=" + orderState.m_warningText
return msg + orderStateMsg
@classmethod
+ def openOrderEnd(cls):
+ return " =============== end ==============="
+
+ @classmethod
def updateAccountValue(cls, key, value, currency, accountName):
return "updateAccountValue: " + key + " " + value + " " + currency
+ " " + accountName
@@ -112,6 +130,10 @@
return "updateAccountTime: " + timeStamp
@classmethod
+ def accountDownloadEnd(cls, accountName):
+ return "accountDownloadEnd: " + accountName
+
+ @classmethod
def nextValidId(cls, orderId):
return "Next Valid Order ID: " + orderId
@@ -123,7 +145,7 @@
@classmethod
def contractDetailsMsg(cls, contractDetails):
- msg = "marketName = " + cls.contractDetails.m_marketName + "\n"
+ "tradingClass = " + cls.contractDetails.m_tradingClass + "\n" + "minTick
= " + cls.contractDetails.m_minTick + "\n" + "price magnifier = " +
cls.contractDetails.m_priceMagnifier + "\n" + "orderTypes = " +
cls.contractDetails.m_orderTypes + "\n" + "validExchanges = " +
cls.contractDetails.m_validExchanges + "\n"
+ msg = "marketName = " + cls.contractDetails.m_marketName + "\n"
+ "tradingClass = " + cls.contractDetails.m_tradingClass + "\n" + "minTick
= " + cls.contractDetails.m_minTick + "\n" + "price magnifier = " +
cls.contractDetails.m_priceMagnifier + "\n" + "orderTypes = " +
cls.contractDetails.m_orderTypes + "\n" + "validExchanges = " +
cls.contractDetails.m_validExchanges + "\n" + "underConId = " +
cls.contractDetails.m_underConId + "\n"
return msg
@classmethod
@@ -142,11 +164,15 @@
return "reqId = " + reqId + " =============== end ==============="
@classmethod
- def execDetails(cls, orderId, contract, execution):
- msg = " ---- Execution Details begin ----\n" + "orderId = " +
str(orderId) + "\n" + "clientId = " + str(execution.m_clientId) + "\n"
+ "symbol = " + contract.m_symbol + "\n" + "secType = " +
contract.m_secType + "\n" + "expiry = " + contract.m_expiry + "\n"
+ "strike = " + contract.m_strike + "\n" + "right = " + contract.m_right
+ "\n" + "contractExchange = " + contract.m_exchange + "\n" + "currency = "
+ contract.m_currency + "\n" + "localSymbol = " + contract.m_localSymbol
+ "\n" + "execId = " + execution.m_execId + "\n" + "time = " +
execution.m_time + "\n" + "acctNumber = " + execution.m_acctNumber + "\n"
+ "executionExchange = " + execution.m_exchange + "\n" + "side = " +
execution.m_side + "\n" + "shares = " + execution.m_shares + "\n" + "price
= " + execution.m_price + "\n" + "permId = " + execution.m_permId + "\n"
+ "liquidation = " + execution.m_liquidation + "\n" + "cumQty = " +
execution.m_cumQty + "\n" + "avgPrice = " + execution.m_avgPrice + "\n" + "
---- Execution Details end ----\n"
+ def execDetails(cls, reqId, contract, execution):
+ msg = " ---- Execution Details begin ----\n" + "reqId = " + reqId
+ "\n" + "orderId = " + execution.m_orderId + "\n" + "clientId = " +
execution.m_clientId + "\n" + "symbol = " + contract.m_symbol + "\n"
+ "secType = " + contract.m_secType + "\n" + "expiry = " +
contract.m_expiry + "\n" + "strike = " + contract.m_strike + "\n" + "right
= " + contract.m_right + "\n" + "contractExchange = " + contract.m_exchange
+ "\n" + "currency = " + contract.m_currency + "\n" + "localSymbol = " +
contract.m_localSymbol + "\n" + "execId = " + execution.m_execId + "\n"
+ "time = " + execution.m_time + "\n" + "acctNumber = " +
execution.m_acctNumber + "\n" + "executionExchange = " +
execution.m_exchange + "\n" + "side = " + execution.m_side + "\n" + "shares
= " + execution.m_shares + "\n" + "price = " + execution.m_price + "\n"
+ "permId = " + execution.m_permId + "\n" + "liquidation = " +
execution.m_liquidation + "\n" + "cumQty = " + execution.m_cumQty + "\n"
+ "avgPrice = " + execution.m_avgPrice + "\n" + " ---- Execution Details
end ----\n"
return msg
@classmethod
+ def execDetailsEnd(cls, reqId):
+ return "reqId = " + reqId + " =============== end ==============="
+
+ @classmethod
def updateMktDepth(cls, tickerId,
position,
operation,
@@ -228,5 +254,9 @@
@classmethod
def fundamentalData(cls, reqId, data):
return "id = " + reqId + " len = " + len(data) + '\n' + data
+
+ @classmethod
+ def deltaNeutralValidation(cls, reqId, underComp):
+ return "id = " + reqId + " underComp.conId =" + underComp.m_conId
+ " underComp.delta =" + underComp.m_delta + " underComp.price =" +
underComp.m_price
Modified: trunk/ib/ext/Order.py
==============================================================================
--- trunk/ib/ext/Order.py (original)
+++ trunk/ib/ext/Order.py Mon Jan 26 11:44:03 2009
@@ -94,6 +94,8 @@
m_settlingFirm = ""
m_clearingAccount = ""
m_clearingIntent = ""
+ m_algoStrategy = ""
+ m_algoParams = list()
m_whatIf = bool()
def __init__(self):
@@ -133,7 +135,9 @@
return True
if (self.m_orderId != l_theOther.m_orderId) or (self.m_clientId !=
l_theOther.m_clientId) or (self.m_totalQuantity !=
l_theOther.m_totalQuantity) or (self.m_lmtPrice != l_theOther.m_lmtPrice)
or (self.m_auxPrice != l_theOther.m_auxPrice) or (self.m_ocaType !=
l_theOther.m_ocaType) or (self.m_transmit != l_theOther.m_transmit) or
(self.m_parentId != l_theOther.m_parentId) or (self.m_blockOrder !=
l_theOther.m_blockOrder) or (self.m_sweepToFill !=
l_theOther.m_sweepToFill) or (self.m_displaySize !=
l_theOther.m_displaySize) or (self.m_triggerMethod !=
l_theOther.m_triggerMethod) or (self.m_outsideRth !=
l_theOther.m_outsideRth) or (self.m_hidden != l_theOther.m_hidden) or
(self.m_overridePercentageConstraints !=
l_theOther.m_overridePercentageConstraints) or (self.m_allOrNone !=
l_theOther.m_allOrNone) or (self.m_minQty != l_theOther.m_minQty) or
(self.m_percentOffset != l_theOther.m_percentOffset) or
(self.m_trailStopPrice != l_theOther.m_trailStopPrice) or (self.m_origin !=
l_theOther.m_origin) or (self.m_shortSaleSlot !=
l_theOther.m_shortSaleSlot) or (self.m_discretionaryAmt !=
l_theOther.m_discretionaryAmt) or (self.m_eTradeOnly !=
l_theOther.m_eTradeOnly) or (self.m_firmQuoteOnly !=
l_theOther.m_firmQuoteOnly) or (self.m_nbboPriceCap !=
l_theOther.m_nbboPriceCap) or (self.m_auctionStrategy !=
l_theOther.m_auctionStrategy) or (self.m_startingPrice !=
l_theOther.m_startingPrice) or (self.m_stockRefPrice !=
l_theOther.m_stockRefPrice) or (self.m_delta != l_theOther.m_delta) or
(self.m_stockRangeLower != l_theOther.m_stockRangeLower) or
(self.m_stockRangeUpper != l_theOther.m_stockRangeUpper) or
(self.m_volatility != l_theOther.m_volatility) or (self.m_volatilityType !=
l_theOther.m_volatilityType) or (self.m_continuousUpdate !=
l_theOther.m_continuousUpdate) or (self.m_referencePriceType !=
l_theOther.m_referencePriceType) or (self.m_deltaNeutralAuxPrice !=
l_theOther.m_deltaNeutralAuxPrice) or (self.m_basisPoints !=
l_theOther.m_basisPoints) or (self.m_basisPointsType !=
l_theOther.m_basisPointsType) or (self.m_scaleInitLevelSize !=
l_theOther.m_scaleInitLevelSize) or (self.m_scaleSubsLevelSize !=
l_theOther.m_scaleSubsLevelSize) or (self.m_scalePriceIncrement !=
l_theOther.m_scalePriceIncrement) or (self.m_whatIf != l_theOther.m_whatIf):
return False
- if (Util.StringCompare(self.m_action, l_theOther.m_action) != 0)
or (Util.StringCompare(self.m_orderType, l_theOther.m_orderType) != 0) or
(Util.StringCompare(self.m_tif, l_theOther.m_tif) != 0) or
(Util.StringCompare(self.m_ocaGroup, l_theOther.m_ocaGroup) != 0) or
(Util.StringCompare(self.m_orderRef, l_theOther.m_orderRef) != 0) or
(Util.StringCompare(self.m_goodAfterTime, l_theOther.m_goodAfterTime) != 0)
or (Util.StringCompare(self.m_goodTillDate, l_theOther.m_goodTillDate) !=
0) or (Util.StringCompare(self.m_rule80A, l_theOther.m_rule80A) != 0) or
(Util.StringCompare(self.m_faGroup, l_theOther.m_faGroup) != 0) or
(Util.StringCompare(self.m_faProfile, l_theOther.m_faProfile) != 0) or
(Util.StringCompare(self.m_faMethod, l_theOther.m_faMethod) != 0) or
(Util.StringCompare(self.m_faPercentage, l_theOther.m_faPercentage) != 0)
or (Util.StringCompare(self.m_openClose, l_theOther.m_openClose) != 0) or
(Util.StringCompare(self.m_designatedLocation,
l_theOther.m_designatedLocation) != 0) or
(Util.StringCompare(self.m_deltaNeutralOrderType,
l_theOther.m_deltaNeutralOrderType) != 0) or
(Util.StringCompare(self.m_account, l_theOther.m_account) != 0) or
(Util.StringCompare(self.m_settlingFirm, l_theOther.m_settlingFirm) != 0)
or (Util.StringCompare(self.m_clearingAccount,
l_theOther.m_clearingAccount) != 0) or
(Util.StringCompare(self.m_clearingIntent, l_theOther.m_clearingIntent) !=
0):
+ if (Util.StringCompare(self.m_action, l_theOther.m_action) != 0)
or (Util.StringCompare(self.m_orderType, l_theOther.m_orderType) != 0) or
(Util.StringCompare(self.m_tif, l_theOther.m_tif) != 0) or
(Util.StringCompare(self.m_ocaGroup, l_theOther.m_ocaGroup) != 0) or
(Util.StringCompare(self.m_orderRef, l_theOther.m_orderRef) != 0) or
(Util.StringCompare(self.m_goodAfterTime, l_theOther.m_goodAfterTime) != 0)
or (Util.StringCompare(self.m_goodTillDate, l_theOther.m_goodTillDate) !=
0) or (Util.StringCompare(self.m_rule80A, l_theOther.m_rule80A) != 0) or
(Util.StringCompare(self.m_faGroup, l_theOther.m_faGroup) != 0) or
(Util.StringCompare(self.m_faProfile, l_theOther.m_faProfile) != 0) or
(Util.StringCompare(self.m_faMethod, l_theOther.m_faMethod) != 0) or
(Util.StringCompare(self.m_faPercentage, l_theOther.m_faPercentage) != 0)
or (Util.StringCompare(self.m_openClose, l_theOther.m_openClose) != 0) or
(Util.StringCompare(self.m_designatedLocation,
l_theOther.m_designatedLocation) != 0) or
(Util.StringCompare(self.m_deltaNeutralOrderType,
l_theOther.m_deltaNeutralOrderType) != 0) or
(Util.StringCompare(self.m_account, l_theOther.m_account) != 0) or
(Util.StringCompare(self.m_settlingFirm, l_theOther.m_settlingFirm) != 0)
or (Util.StringCompare(self.m_clearingAccount,
l_theOther.m_clearingAccount) != 0) or
(Util.StringCompare(self.m_clearingIntent, l_theOther.m_clearingIntent) !=
0) or (Util.StringCompare(self.m_algoStrategy,
l_theOther.m_algoStrategy) != 0):
+ return False
+ if not Util.VectorEqualsUnordered(self.m_algoParams,
l_theOther.m_algoParams):
return False
return True
Added: trunk/ib/ext/TagValue.py
==============================================================================
--- (empty file)
+++ trunk/ib/ext/TagValue.py Mon Jan 26 11:44:03 2009
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+##
+# Translated source for TagValue.
+##
+
+# Source file: TagValue.java
+# Target file: TagValue.py
+#
+# Original file copyright original author(s).
+# This file copyright Troy Melhase, tr...@gci.net.
+#
+# WARNING: all changes to this file will be lost.
+
+from ib.lib.overloading import overloaded
+
+class TagValue(object):
+ """ generated source for TagValue
+
+ """
+ m_tag = ""
+ m_value = ""
+
+ @overloaded
+ def __init__(self):
+ pass
+
+ @__init__.register(object, str, str)
+ def __init___0(self, p_tag, p_value):
+ self.m_tag = p_tag
+ self.m_value = p_value
+
+ def __eq__(self, p_other):
+ if self is p_other:
+ return True
+ if p_other is None:
+ return False
+ l_theOther = p_other
+ if (Util.StringCompare(self.m_tag, l_theOther.m_tag) != 0) or
(Util.StringCompare(self.m_value, l_theOther.m_value) != 0):
+ return False
+ return True
+
+
Modified: trunk/ib/ext/Util.py
==============================================================================
--- trunk/ib/ext/Util.py (original)
+++ trunk/ib/ext/Util.py Mon Jan 26 11:44:03 2009
@@ -21,6 +21,10 @@
"""
@classmethod
+ def StringIsEmpty(cls, strval):
+ return strval is None or len((strval) == 0)
+
+ @classmethod
def NormalizeString(cls, strval):
return strval if strval is not None else ""
@@ -31,6 +35,35 @@
@classmethod
def StringCompareIgnCase(cls, lhs, rhs):
return cmp(str(lhs).lower(), str(rhs).lower())
+
+ @classmethod
+ def VectorEqualsUnordered(cls, lhs, rhs):
+ if (lhs == rhs):
+ return True
+ lhsCount = 0 if lhs is None else len(lhs)
+ rhsCount = 0 if rhs is None else len(rhs)
+ if (lhsCount != rhsCount):
+ return False
+ if (lhsCount == 0):
+ return True
+ matchedRhsElems = [bool() for __idx0 in range(rhsCount)]
+ ## for-while
+ lhsIdx = 0
+ while lhsIdx < lhsCount:
+ lhsElem = lhs[lhsIdx]
+ rhsIdx = 0
+ ## for-while
+ while rhsIdx < rhsCount:
+ if matchedRhsElems[rhsIdx]:
+ continue
+ if lhsElem == rhs[rhsIdx]:
+ matchedRhsElems[rhsIdx] = True
+ break
+ rhsIdx += 1
+ if rhsIdx >= rhsCount:
+ return False
+ lhsIdx += 1
+ return True
@classmethod
def IntMaxString(cls, value):
Modified: trunk/ib/ext/cfg/Contract.py
==============================================================================
--- trunk/ib/ext/cfg/Contract.py (original)
+++ trunk/ib/ext/cfg/Contract.py Mon Jan 26 11:44:03 2009
@@ -15,4 +15,6 @@
(r'retval\.m_comboLegs\.clone\(\)', r'self.m_comboLegs[:]'),
(r' m_comboLegs = \[\]', r' m_comboLegs = None'),
(r' m_underComp = UnderComp\(\)', r' m_underComp = None'),
+ (r' def __init__\(self\)\:',
+ r' def __init__(self):\n self.comboLegs = []'),
]
Modified: trunk/ib/ext/cfg/EClientSocket.py
==============================================================================
--- trunk/ib/ext/cfg/EClientSocket.py (original)
+++ trunk/ib/ext/cfg/EClientSocket.py Mon Jan 26 11:44:03 2009
@@ -25,6 +25,7 @@
(r' m_reader = EReader\(\)', r' m_reader = None'),
(r' m_anyWrapper = AnyWrapper\(\)', r' m_anyWrapper = None'),
(r' m_dos = DataOutputStream\(\)', r' m_dos = None'),
+ (r'EOL = \[0\]', r'EOL = 0'),
(r'(, "" \+ e)', r', str(e)'),
(r'print "Server Version:" \+ self\.m_serverVersion',
Added: trunk/ib/ext/cfg/TagValue.py
==============================================================================
--- (empty file)
+++ trunk/ib/ext/cfg/TagValue.py Mon Jan 26 11:44:03 2009
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+""" ib.ext.cfg.TagValue -> config module for TagValue.java.
+
+"""
+modulePreamble = [
+ 'from ib.lib.overloading import overloaded',
+ ]