Added:
trunk/ib/ext/UnderComp.py (contents, props changed)
trunk/ib/ext/cfg/UnderComp.py (contents, props changed)
Modified:
trunk/Makefile
trunk/demo/api_coverage
trunk/ib/ext/Contract.py
trunk/ib/ext/EClientErrors.py
trunk/ib/ext/EClientSocket.py
trunk/ib/ext/EReader.py
trunk/ib/ext/EWrapper.py
trunk/ib/ext/EWrapperMsgGenerator.py
trunk/ib/ext/Execution.py
trunk/ib/ext/Order.py
trunk/ib/ext/TickType.py
trunk/ib/ext/cfg/Contract.py
trunk/ib/ext/cfg/EReader.py
Log:
Initial support for api version 9.51.
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Sat Aug 30 04:04:23 2008
@@ -9,7 +9,7 @@
##
-ibpy_ver := 0.7.5
+ibpy_ver := 0.7.6a
ibpy_rev := $(shell svnversion|cut -f 2 -d \:|cut -f 1 -d M)
twsapi_ver := $(shell cat ib/ext/src/IBJts/API_VersionNum.txt |cut -f 2
-d \=)
release_num := $(ibpy_ver)-$(twsapi_ver)
Modified: trunk/demo/api_coverage
==============================================================================
--- trunk/demo/api_coverage (original)
+++ trunk/demo/api_coverage Sat Aug 30 04:04:23 2008
@@ -88,6 +88,9 @@
contract.m_symbol = symbol
contract.m_secType = 'STK'
contract.m_exchange = 'SMART'
+ contract.m_primaryExch = 'SMART'
+ contract.m_currency = 'USD'
+ contract.m_localSymbol = symbol
return contract
@@ -102,7 +105,7 @@
def exec_filter(client_id):
- contract = make_contract('QQQQ')
+ contract = make_contract('NVDA')
filt = ExecutionFilter()
filt.m_clientId = client_id
filt.m_symbol = contract.m_symbol
@@ -176,7 +179,7 @@
def test_002(connection, options):
ticker_id = gen_tick_id()
- contract = make_contract('QQQQ')
+ contract = make_contract('NVDA')
connection.reqMktData(ticker_id, contract, generic_tick_keys, False)
short_sleep()
connection.cancelMktData(ticker_id)
@@ -212,11 +215,11 @@
order = make_order(askprice)
if options.demo:
connection.placeOrder(id=next_order_id(),
- contract=make_contract('QQQQ'),
+ contract=make_contract('NVDA'),
order=order)
#connection.exerciseOptions()
- contract = make_contract('QQQQ')
- connection.reqContractDetails(contract)
+ contract = make_contract('NVDA')
+ connection.reqContractDetails(3, contract)
def test_007(connection, options):
@@ -305,12 +308,12 @@
parser = OptionParser(version=version)
add = parser.add_option
add('-d', '--demo', dest='demo', action='store_true',
- help='Server using demo account, safe for placing orders.')
+ help='Server using demo account, safe for placing orders')
add('-m', '--messages', dest='printmsgs', action='store_true',
- help='Print message type names and exit.')
+ help='Print message type names and exit')
add('-s', '--show', dest='showmsgs', metavar='MSG[:MAX]',
action='append',
- help=('Print no more than MAX messages of type MSG. May use ALL
to '
- 'print all messages. May be repeated.'), default=[])
+ help=('Print no more than MAX messages of type MSG, may use ALL
to '
+ 'print all messages, may be repeated'), default=[])
add('-n', '--host', dest='host', default='localhost',
help='Name or address of remote server (default: %default)')
add('-p', '--port', dest='port', default=7496, type='int',
@@ -318,7 +321,7 @@
add('-c', '--client', dest='clientid', metavar='ID', default=0,
type='int',
help='Client id for remote connection (default: %default)')
add('-v', '--verbose', default=0, action='count',
- help='Verbose output. May be repeated.')
+ help='Verbose output, may be repeated')
opts, args = parser.parse_args()
return opts
Modified: trunk/ib/ext/Contract.py
==============================================================================
--- trunk/ib/ext/Contract.py (original)
+++ trunk/ib/ext/Contract.py Sat Aug 30 04:04:23 2008
@@ -15,6 +15,7 @@
from ib.lib.overloading import overloaded
from ib.lib import Cloneable
+from ib.ext.UnderComp import UnderComp
from ib.ext.Util import Util
class Contract(Cloneable):
@@ -35,6 +36,7 @@
m_includeExpired = bool()
m_comboLegsDescrip = ""
m_comboLegs = []
+ m_underComp = UnderComp()
@overloaded
def __init__(self):
@@ -113,6 +115,11 @@
if ctr2 >= comboLegsSize:
return False
ctr1 += 1
+ if (self.m_underComp != l_theOther.m_underComp):
+ if self.m_underComp is None or l_theOther.m_underComp is None:
+ return False
+ if not self.m_underComp == l_theOther.m_underComp:
+ return False
return True
Modified: trunk/ib/ext/EClientErrors.py
==============================================================================
--- trunk/ib/ext/EClientErrors.py (original)
+++ trunk/ib/ext/EClientErrors.py Sat Aug 30 04:04:23 2008
@@ -63,6 +63,8 @@
FAIL_SEND_REQRTBARS = CodeMsgPair(529, "Request Real-time Bar Data
Sending Error - ")
FAIL_SEND_CANRTBARS = CodeMsgPair(530, "Cancel Real-time Bar Data
Sending Error - ")
FAIL_SEND_REQCURRTIME = CodeMsgPair(531, "Request Current Time Sending
Error - ")
+ FAIL_SEND_REQFUNDDATA = CodeMsgPair(532, "Request Fundamental Data
Sending Error - ")
+ FAIL_SEND_CANFUNDDATA = CodeMsgPair(533, "Cancel Fundamental Data
Sending Error - ")
def __init__(self):
pass
Modified: trunk/ib/ext/EClientSocket.py
==============================================================================
--- trunk/ib/ext/EClientSocket.py (original)
+++ trunk/ib/ext/EClientSocket.py Sat Aug 30 04:04:23 2008
@@ -32,7 +32,7 @@
""" generated source for EClientSocket
"""
- CLIENT_VERSION = 37
+ CLIENT_VERSION = 38
SERVER_VERSION = 38
EOL = 0
BAG_SEC_TYPE = "BAG"
@@ -78,6 +78,8 @@
REQ_CURRENT_TIME = 49
REQ_REAL_TIME_BARS = 50
CANCEL_REAL_TIME_BARS = 51
+ REQ_FUNDAMENTAL_DATA = 52
+ CANCEL_FUNDAMENTAL_DATA = 53
MIN_SERVER_VER_REAL_TIME_BARS = 34
MIN_SERVER_VER_SCALE_ORDERS = 35
MIN_SERVER_VER_SNAPSHOT_MKT_DATA = 35
@@ -85,12 +87,15 @@
MIN_SERVER_VER_WHAT_IF_ORDERS = 36
MIN_SERVER_VER_CONTRACT_CONID = 37
MIN_SERVER_VER_PTA_ORDERS = 39
+ MIN_SERVER_VER_FUNDAMENTAL_DATA = 40
+ MIN_SERVER_VER_UNDER_COMP = 40
+ MIN_SERVER_VER_CONTRACT_DATA_CHAIN = 40
+ MIN_SERVER_VER_SCALE_ORDERS2 = 40
m_anyWrapper = None
- m_socket = None
m_dos = None
m_connected = bool()
m_reader = None
- m_serverVersion = 1
+ m_serverVersion = 0
m_TwsTime = ""
def serverVersion(self):
@@ -121,6 +126,7 @@
socket = Socket(host, port)
self.eConnect(socket, clientId)
except (Exception, ), e:
+ self.eDisconnect()
self.connectionError()
def connectionError(self):
@@ -141,17 +147,16 @@
@eConnect.register(object, Socket, int)
@synchronized(mlock)
def eConnect_0(self, socket, clientId):
- self.m_socket = socket
- dis = DataInputStream(self.m_socket.getInputStream())
- self.m_dos = DataOutputStream(self.m_socket.getOutputStream())
+ self.m_dos = DataOutputStream(socket.getOutputStream())
self.send(self.CLIENT_VERSION)
- self.m_reader = self.createReader(self, dis)
+ self.m_reader = self.createReader(self,
DataInputStream(socket.getInputStream()))
self.m_serverVersion = self.m_reader.readInt()
debug("Server Version: %s", self.m_serverVersion)
if self.m_serverVersion >= 20:
self.m_TwsTime = self.m_reader.readStr()
debug("TWS Time at connection: %s", self.m_TwsTime)
if self.m_serverVersion < self.SERVER_VERSION:
+ self.eDisconnect()
self.m_anyWrapper.error(EClientErrors.NO_VALID_ID,
EClientErrors.UPDATE_TWS.code(), EClientErrors.UPDATE_TWS.msg())
return
if self.m_serverVersion >= 3:
@@ -161,17 +166,25 @@
@synchronized(mlock)
def eDisconnect(self):
- if not self.m_connected:
+ if self.m_dos is None:
return
+ self.m_connected = False
+ self.m_serverVersion = 0
+ self.m_TwsTime = ""
+ dos = self.m_dos
+ self.m_dos = None
+ self.reader = self.m_reader
+ self.m_reader = None
try:
- if self.m_reader is not None:
- self.m_reader.interrupt()
- if self.m_socket is not None:
- self.m_socket.shutdown(SHUT_RDWR)
- self.m_socket.close()
+ if self.reader is not None:
+ self.reader.interrupt()
+ except (Exception, ), e:
+ pass
+ try:
+ if dos is not None:
+ dos.close()
except (Exception, ), e:
pass
- self.m_connected = False
@synchronized(mlock)
def cancelScannerSubscription(self, tickerId):
@@ -254,7 +267,11 @@
if self.m_serverVersion < self.MIN_SERVER_VER_SNAPSHOT_MKT_DATA
and snapshot:
self.error(tickerId, EClientErrors.UPDATE_TWS, " It does not
support snapshot market data requests.")
return
- VERSION = 7
+ if self.m_serverVersion < self.MIN_SERVER_VER_UNDER_COMP:
+ if contract.m_underComp is not None:
+ self.error(tickerId, EClientErrors.UPDATE_TWS, " It does
not support delta-neutral orders.")
+ return
+ VERSION = 8
try:
self.send(self.REQ_MKT_DATA)
self.send(VERSION)
@@ -287,6 +304,15 @@
self.send(comboLeg.m_action)
self.send(comboLeg.m_exchange)
i += 1
+ if self.m_serverVersion >= self.MIN_SERVER_VER_UNDER_COMP:
+ if contract.m_underComp is not None:
+ underComp = contract.m_underComp
+ self.send(True)
+ self.send(underComp.m_conId)
+ self.send(underComp.m_delta)
+ self.send(underComp.m_price)
+ else:
+ self.send(False)
if self.m_serverVersion >= 31:
self.send(genericTickList)
if self.m_serverVersion >=
self.MIN_SERVER_VER_SNAPSHOT_MKT_DATA:
@@ -422,17 +448,19 @@
self.close()
@synchronized(mlock)
- def reqContractDetails(self, contract):
+ def reqContractDetails(self, reqId, contract):
if not self.m_connected:
self.error(EClientErrors.NO_VALID_ID,
EClientErrors.NOT_CONNECTED, "")
return
if self.m_serverVersion < 4:
self.error(EClientErrors.NO_VALID_ID,
EClientErrors.UPDATE_TWS.code(), EClientErrors.UPDATE_TWS.msg())
return
- VERSION = 4
+ VERSION = 5
try:
self.send(self.REQ_CONTRACT_DATA)
self.send(VERSION)
+ if self.m_serverVersion >=
self.MIN_SERVER_VER_CONTRACT_DATA_CHAIN:
+ self.send(reqId)
if self.m_serverVersion >= self.MIN_SERVER_VER_CONTRACT_CONID:
self.send(contract.m_conId)
self.send(contract.m_symbol)
@@ -552,7 +580,7 @@
self.error(EClientErrors.NO_VALID_ID,
EClientErrors.NOT_CONNECTED, "")
return
if self.m_serverVersion < self.MIN_SERVER_VER_SCALE_ORDERS:
- if (order.m_scaleNumComponents != Integer.MAX_VALUE) or
(order.m_scaleComponentSize != Integer.MAX_VALUE) or
(order.m_scalePriceIncrement != Double.MAX_VALUE):
+ if (order.m_scaleInitLevelSize != Integer.MAX_VALUE) or
(order.m_scalePriceIncrement != Double.MAX_VALUE):
self.error(id, EClientErrors.UPDATE_TWS, " It does not
support Scale orders.")
return
if self.m_serverVersion < self.MIN_SERVER_VER_SSHORT_COMBO_LEGS:
@@ -570,7 +598,15 @@
if order.m_whatIf:
self.error(id, EClientErrors.UPDATE_TWS, " It does not
support what-if orders.")
return
- VERSION = 25
+ if self.m_serverVersion < self.MIN_SERVER_VER_UNDER_COMP:
+ if contract.m_underComp is not None:
+ self.error(id, EClientErrors.UPDATE_TWS, " It does not
support delta-neutral orders.")
+ return
+ if self.m_serverVersion < self.MIN_SERVER_VER_SCALE_ORDERS2:
+ 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
try:
self.send(self.PLACE_ORDER)
self.send(VERSION)
@@ -688,12 +724,25 @@
if self.m_serverVersion >= 30:
self.sendMax(order.m_trailStopPrice)
if self.m_serverVersion >= self.MIN_SERVER_VER_SCALE_ORDERS:
- self.sendMax(order.m_scaleNumComponents)
- self.sendMax(order.m_scaleComponentSize)
+ if self.m_serverVersion >=
self.MIN_SERVER_VER_SCALE_ORDERS2:
+ self.sendMax(order.m_scaleInitLevelSize)
+ self.sendMax(order.m_scaleSubsLevelSize)
+ else:
+ self.send("")
+ self.sendMax(order.m_scaleInitLevelSize)
self.sendMax(order.m_scalePriceIncrement)
if self.m_serverVersion >= self.MIN_SERVER_VER_PTA_ORDERS:
self.send(order.m_clearingAccount)
self.send(order.m_clearingIntent)
+ if self.m_serverVersion >= self.MIN_SERVER_VER_UNDER_COMP:
+ if contract.m_underComp is not None:
+ underComp = contract.m_underComp
+ self.send(True)
+ self.send(underComp.m_conId)
+ self.send(underComp.m_delta)
+ self.send(underComp.m_price)
+ else:
+ self.send(False)
if self.m_serverVersion >= self.MIN_SERVER_VER_WHAT_IF_ORDERS:
self.send(order.m_whatIf)
except (Exception, ), e:
@@ -910,6 +959,47 @@
self.error(EClientErrors.NO_VALID_ID,
EClientErrors.FAIL_SEND_REQCURRTIME, str(e))
self.close()
+ @synchronized(mlock)
+ def reqFundamentalData(self, reqId, contract, reportType):
+ if not self.m_connected:
+ self.error(reqId, EClientErrors.NOT_CONNECTED, "")
+ return
+ if self.m_serverVersion < self.MIN_SERVER_VER_FUNDAMENTAL_DATA:
+ self.error(reqId, EClientErrors.UPDATE_TWS, " It does not
support fundamental data requests.")
+ return
+ VERSION = 1
+ try:
+ self.send(self.REQ_FUNDAMENTAL_DATA)
+ self.send(VERSION)
+ self.send(reqId)
+ self.send(contract.m_symbol)
+ self.send(contract.m_secType)
+ self.send(contract.m_exchange)
+ self.send(contract.m_primaryExch)
+ self.send(contract.m_currency)
+ self.send(contract.m_localSymbol)
+ self.send(reportType)
+ except (Exception, ), e:
+ self.error(reqId, EClientErrors.FAIL_SEND_REQFUNDDATA, str(e))
+ self.close()
+
+ @synchronized(mlock)
+ def cancelFundamentalData(self, reqId):
+ if not self.m_connected:
+ self.error(reqId, EClientErrors.NOT_CONNECTED, "")
+ return
+ if self.m_serverVersion < self.MIN_SERVER_VER_FUNDAMENTAL_DATA:
+ self.error(reqId, EClientErrors.UPDATE_TWS, " It does not
support fundamental data requests.")
+ return
+ VERSION = 1
+ try:
+ self.send(self.CANCEL_FUNDAMENTAL_DATA)
+ self.send(VERSION)
+ self.send(reqId)
+ except (Exception, ), e:
+ self.error(reqId, EClientErrors.FAIL_SEND_CANFUNDDATA, str(e))
+ self.close()
+
@overloaded
@synchronized(mlock)
def error(self, err):
@@ -922,7 +1012,7 @@
def close(self):
self.eDisconnect()
- self.m_anyWrapper.connectionClosed()
+ self.wrapper().connectionClosed()
@classmethod
def is_(cls, strval):
Modified: trunk/ib/ext/EReader.py
==============================================================================
--- trunk/ib/ext/EReader.py (original)
+++ trunk/ib/ext/EReader.py Sat Aug 30 04:04:23 2008
@@ -22,6 +22,7 @@
from ib.ext.Order import Order
from ib.ext.OrderState import OrderState
from ib.ext.TickType import TickType
+from ib.ext.UnderComp import UnderComp
from ib.lib.logger import logger
# micro optimizations
@@ -57,6 +58,8 @@
TICK_EFP = 47
CURRENT_TIME = 49
REAL_TIME_BARS = 50
+ FUNDAMENTAL_DATA = 51
+ CONTRACT_DATA_END = 52
m_parent = None
m_dis = None
@@ -82,10 +85,10 @@
while not self.isInterrupted() and
self.processMsg(self.readInt()):
pass
except (Exception, ), ex:
- errmsg = ("Exception while processing message.")
- logger().exception(errmsg)
- self.parent().wrapper().error(ex)
- self.m_parent.close()
+ if self.parent().isConnected():
+ self.eWrapper().error(ex)
+ if self.parent().isConnected():
+ self.m_parent.close()
def processMsg(self, msgId):
if (msgId == -1):
@@ -202,6 +205,9 @@
contract.m_expiry = self.readStr()
contract.m_strike = self.readDouble()
contract.m_right = self.readStr()
+ if version >= 7:
+ contract.m_multiplier = self.readStr()
+ contract.m_primaryExch = self.readStr()
contract.m_currency = self.readStr()
if version >= 2:
contract.m_localSymbol = self.readStr()
@@ -218,6 +224,8 @@
accountName = None
if version >= 4:
accountName = self.readStr()
+ if (version == 6) and (self.m_parent.serverVersion() == 39):
+ contract.m_primaryExch = self.readStr()
self.eWrapper().updatePortfolio(contract, position,
marketPrice, marketValue, averageCost, unrealizedPNL, realizedPNL,
accountName)
elif msgId == self.ACCT_UPDATE_TIME:
version = self.readInt()
@@ -328,12 +336,23 @@
order.m_basisPointsType = self.readInt()
contract.m_comboLegsDescrip = self.readStr()
if version >= 15:
- order.m_scaleNumComponents = self.readIntMax()
- order.m_scaleComponentSize = self.readIntMax()
+ if version >= 20:
+ order.m_scaleInitLevelSize = self.readIntMax()
+ order.m_scaleSubsLevelSize = self.readIntMax()
+ else:
+ self.readIntMax()
+ order.m_scaleInitLevelSize = self.readIntMax()
order.m_scalePriceIncrement = self.readDoubleMax()
if version >= 19:
order.m_clearingAccount = self.readStr()
order.m_clearingIntent = self.readStr()
+ if version >= 20:
+ if self.readBoolFromInt():
+ underComp = UnderComp()
+ underComp.m_conId = self.readInt()
+ underComp.m_delta = self.readDouble()
+ underComp.m_price = self.readDouble()
+ contract.m_underComp = underComp
orderState = OrderState()
if version >= 16:
order.m_whatIf = self.readBoolFromInt()
@@ -383,6 +402,9 @@
self.eWrapper().scannerDataEnd(tickerId)
elif msgId == self.CONTRACT_DATA:
version = self.readInt()
+ reqId = -1
+ if version >= 3:
+ reqId = self.readInt()
contract = ContractDetails()
contract.m_summary.m_symbol = self.readStr()
contract.m_summary.m_secType = self.readStr()
@@ -401,9 +423,12 @@
contract.m_validExchanges = self.readStr()
if version >= 2:
contract.m_priceMagnifier = self.readInt()
- self.eWrapper().contractDetails(contract)
+ self.eWrapper().contractDetails(reqId, contract)
elif msgId == self.BOND_CONTRACT_DATA:
version = self.readInt()
+ reqId = -1
+ if version >= 3:
+ reqId = self.readInt()
contract = ContractDetails()
contract.m_summary.m_symbol = self.readStr()
contract.m_summary.m_secType = self.readStr()
@@ -431,7 +456,7 @@
contract.m_nextOptionType = self.readStr()
contract.m_nextOptionPartial = self.readBoolFromInt()
contract.m_notes = self.readStr()
- self.eWrapper().bondContractDetails(contract)
+ self.eWrapper().bondContractDetails(reqId, contract)
elif msgId == self.EXECUTION_DATA:
version = self.readInt()
orderId = self.readInt()
@@ -461,6 +486,9 @@
exec_.m_clientId = self.readInt()
if version >= 4:
exec_.m_liquidation = self.readInt()
+ if version >= 6:
+ exec_.m_cumQty = self.readInt()
+ exec_.m_avgPrice = self.readDouble()
self.eWrapper().execDetails(orderId, contract, exec_)
elif msgId == self.MARKET_DEPTH:
version = self.readInt()
@@ -545,6 +573,15 @@
wap = self.readDouble()
count = self.readInt()
self.eWrapper().realtimeBar(reqId, time, open, high, low,
close, volume, wap, count)
+ elif msgId == self.FUNDAMENTAL_DATA:
+ self.readInt()
+ reqId = self.readInt()
+ data = self.readStr()
+ self.eWrapper().fundamentalData(reqId, data)
+ elif msgId == self.CONTRACT_DATA_END:
+ self.readInt()
+ reqId = self.readInt()
+ self.eWrapper().contractDetailsEnd(reqId)
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 Sat Aug 30 04:04:23 2008
@@ -85,10 +85,13 @@
def nextValidId(self, orderId):
raise NotImplementedError()
- def contractDetails(self, contractDetails):
+ def contractDetails(self, reqId, contractDetails):
raise NotImplementedError()
- def bondContractDetails(self, contractDetails):
+ def bondContractDetails(self, reqId, contractDetails):
+ raise NotImplementedError()
+
+ def contractDetailsEnd(self, reqId):
raise NotImplementedError()
def execDetails(self, orderId, contract, execution):
@@ -159,6 +162,9 @@
raise NotImplementedError()
def currentTime(self, time):
+ raise NotImplementedError()
+
+ def fundamentalData(self, reqId, data):
raise NotImplementedError()
Modified: trunk/ib/ext/EWrapperMsgGenerator.py
==============================================================================
--- trunk/ib/ext/EWrapperMsgGenerator.py (original)
+++ trunk/ib/ext/EWrapperMsgGenerator.py Sat Aug 30 04:04:23 2008
@@ -78,13 +78,16 @@
@classmethod
def openOrder(cls, orderId, contract, order, orderState):
- msg = "open order: orderId=" + orderId + " action=" +
order.m_action + " quantity=" + order.m_totalQuantity + " symbol=" +
contract.m_symbol + " exchange=" + contract.m_exchange + " secType=" +
contract.m_secType + " type=" + order.m_orderType + " lmtPrice=" +
order.m_lmtPrice + " auxPrice=" + order.m_auxPrice + " TIF=" + order.m_tif
+ " localSymbol=" + contract.m_localSymbol + " client Id=" +
order.m_clientId + " parent Id=" + order.m_parentId + " permId=" +
order.m_permId + " outsideRth=" + order.m_outsideRth + " hidden=" +
order.m_hidden + " discretionaryAmt=" + order.m_discretionaryAmt + "
triggerMethod=" + order.m_triggerMethod + " goodAfterTime=" +
order.m_goodAfterTime + " goodTillDate=" + order.m_goodTillDate + "
faGroup=" + order.m_faGroup + " faMethod=" + order.m_faMethod + "
faPercentage=" + order.m_faPercentage + " faProfile=" + order.m_faProfile
+ " shortSaleSlot=" + order.m_shortSaleSlot + " designatedLocation=" +
order.m_designatedLocation + " ocaGroup=" + order.m_ocaGroup + " ocaType="
+ order.m_ocaType + " rule80A=" + order.m_rule80A + " allOrNone=" +
order.m_allOrNone + " minQty=" + order.m_minQty + " percentOffset=" +
order.m_percentOffset + " eTradeOnly=" + order.m_eTradeOnly + "
firmQuoteOnly=" + order.m_firmQuoteOnly + " nbboPriceCap=" +
order.m_nbboPriceCap + " auctionStrategy=" + order.m_auctionStrategy + "
startingPrice=" + order.m_startingPrice + " stockRefPrice=" +
order.m_stockRefPrice + " delta=" + order.m_delta + " stockRangeLower=" +
order.m_stockRangeLower + " stockRangeUpper=" + order.m_stockRangeUpper + "
volatility=" + order.m_volatility + " volatilityType=" +
order.m_volatilityType + " deltaNeutralOrderType=" +
order.m_deltaNeutralOrderType + " deltaNeutralAuxPrice=" +
order.m_deltaNeutralAuxPrice + " continuousUpdate=" +
order.m_continuousUpdate + " referencePriceType=" +
order.m_referencePriceType + " trailStopPrice=" + order.m_trailStopPrice
+ " scaleNumComponents=" + Util.IntMaxString(order.m_scaleNumComponents)
+ " scaleComponentSize=" + Util.IntMaxString(order.m_scaleComponentSize)
+ " scalePriceIncrement=" +
Util.DoubleMaxString(order.m_scalePriceIncrement) + " account=" +
order.m_account + " settlingFirm=" + order.m_settlingFirm + "
clearingAccount=" + order.m_clearingAccount + " clearingIntent=" +
order.m_clearingIntent + " whatIf=" + order.m_whatIf
+ msg = "open order: orderId=" + orderId + " action=" +
order.m_action + " quantity=" + order.m_totalQuantity + " symbol=" +
contract.m_symbol + " exchange=" + contract.m_exchange + " secType=" +
contract.m_secType + " type=" + order.m_orderType + " lmtPrice=" +
order.m_lmtPrice + " auxPrice=" + order.m_auxPrice + " TIF=" + order.m_tif
+ " localSymbol=" + contract.m_localSymbol + " client Id=" +
order.m_clientId + " parent Id=" + order.m_parentId + " permId=" +
order.m_permId + " outsideRth=" + order.m_outsideRth + " hidden=" +
order.m_hidden + " discretionaryAmt=" + order.m_discretionaryAmt + "
triggerMethod=" + order.m_triggerMethod + " goodAfterTime=" +
order.m_goodAfterTime + " goodTillDate=" + order.m_goodTillDate + "
faGroup=" + order.m_faGroup + " faMethod=" + order.m_faMethod + "
faPercentage=" + order.m_faPercentage + " faProfile=" + order.m_faProfile
+ " shortSaleSlot=" + order.m_shortSaleSlot + " designatedLocation=" +
order.m_designatedLocation + " ocaGroup=" + order.m_ocaGroup + " ocaType="
+ order.m_ocaType + " rule80A=" + order.m_rule80A + " allOrNone=" +
order.m_allOrNone + " minQty=" + order.m_minQty + " percentOffset=" +
order.m_percentOffset + " eTradeOnly=" + order.m_eTradeOnly + "
firmQuoteOnly=" + order.m_firmQuoteOnly + " nbboPriceCap=" +
order.m_nbboPriceCap + " auctionStrategy=" + order.m_auctionStrategy + "
startingPrice=" + order.m_startingPrice + " stockRefPrice=" +
order.m_stockRefPrice + " delta=" + order.m_delta + " stockRangeLower=" +
order.m_stockRangeLower + " stockRangeUpper=" + order.m_stockRangeUpper + "
volatility=" + order.m_volatility + " volatilityType=" +
order.m_volatilityType + " deltaNeutralOrderType=" +
order.m_deltaNeutralOrderType + " deltaNeutralAuxPrice=" +
order.m_deltaNeutralAuxPrice + " continuousUpdate=" +
order.m_continuousUpdate + " referencePriceType=" +
order.m_referencePriceType + " trailStopPrice=" + order.m_trailStopPrice
+ " scaleInitLevelSize=" + Util.IntMaxString(order.m_scaleInitLevelSize)
+ " scaleSubsLevelSize=" + Util.IntMaxString(order.m_scaleSubsLevelSize)
+ " scalePriceIncrement=" +
Util.DoubleMaxString(order.m_scalePriceIncrement) + " account=" +
order.m_account + " settlingFirm=" + order.m_settlingFirm + "
clearingAccount=" + order.m_clearingAccount + " clearingIntent=" +
order.m_clearingIntent + " whatIf=" + order.m_whatIf
if "BAG" == contract.m_secType:
if contract.m_comboLegsDescrip is not None:
msg += " comboLegsDescrip=" + contract.m_comboLegsDescrip
if (order.m_basisPoints != Double.MAX_VALUE):
msg += " basisPoints=" + order.m_basisPoints
msg += " basisPointsType=" + order.m_basisPointsType
+ 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
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
@@ -113,9 +116,9 @@
return "Next Valid Order ID: " + orderId
@classmethod
- def contractDetails(cls, contractDetails):
+ def contractDetails(cls, reqId, contractDetails):
contract = cls.contractDetails.m_summary
- msg = " ---- Contract Details begin ----\n" +
cls.contractMsg(contract) + cls.contractDetailsMsg(cls.contractDetails) + "
---- Contract Details End ----\n"
+ msg = "reqId = " + reqId + "
===================================\n" + " ---- Contract Details begin
----\n" + cls.contractMsg(contract) +
cls.contractDetailsMsg(cls.contractDetails) + " ---- Contract Details End
----\n"
return msg
@classmethod
@@ -125,18 +128,22 @@
@classmethod
def contractMsg(cls, contract):
- msg = " ---- Contract Details begin ----\n" + "conid = " +
contract.m_conId + "\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" + "multiplier = " + contract.m_multiplier + "\n" + "exchange = " +
contract.m_exchange + "\n" + "currency = " + contract.m_currency + "\n"
+ "localSymbol = " + contract.m_localSymbol + "\n"
+ msg = "conid = " + contract.m_conId + "\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" + "multiplier = " +
contract.m_multiplier + "\n" + "exchange = " + contract.m_exchange + "\n"
+ "primaryExch = " + contract.m_primaryExch + "\n" + "currency = " +
contract.m_currency + "\n" + "localSymbol = " + contract.m_localSymbol
+ "\n"
return msg
@classmethod
- def bondContractDetails(cls, contractDetails):
+ def bondContractDetails(cls, reqId, contractDetails):
contract = cls.contractDetails.m_summary
- msg = " ---- Bond Contract Details begin ----\n" + "symbol = " +
contract.m_symbol + "\n" + "secType = " + contract.m_secType + "\n"
+ "cusip = " + cls.contractDetails.m_cusip + "\n" + "coupon = " +
cls.contractDetails.m_coupon + "\n" + "maturity = " +
cls.contractDetails.m_maturity + "\n" + "issueDate = " +
cls.contractDetails.m_issueDate + "\n" + "ratings = " +
cls.contractDetails.m_ratings + "\n" + "bondType = " +
cls.contractDetails.m_bondType + "\n" + "couponType = " +
cls.contractDetails.m_couponType + "\n" + "convertible = " +
cls.contractDetails.m_convertible + "\n" + "callable = " +
cls.contractDetails.m_callable + "\n" + "putable = " +
cls.contractDetails.m_putable + "\n" + "descAppend = " +
cls.contractDetails.m_descAppend + "\n" + "exchange = " +
contract.m_exchange + "\n" + "currency = " + contract.m_currency + "\n"
+ "marketName = " + cls.contractDetails.m_marketName + "\n" + "tradingClass
= " + cls.contractDetails.m_tradingClass + "\n" + "conid = " +
contract.m_conId + "\n" + "minTick = " + cls.contractDetails.m_minTick
+ "\n" + "orderTypes = " + cls.contractDetails.m_orderTypes + "\n"
+ "validExchanges = " + cls.contractDetails.m_validExchanges + "\n"
+ "nextOptionDate = " + cls.contractDetails.m_nextOptionDate + "\n"
+ "nextOptionType = " + cls.contractDetails.m_nextOptionType + "\n"
+ "nextOptionPartial = " + cls.contractDetails.m_nextOptionPartial + "\n"
+ "notes = " + cls.contractDetails.m_notes + "\n" + " ---- Bond Contract
Details End ----\n"
+ msg = "reqId = " + reqId + "
===================================\n" + " ---- Bond Contract Details begin
----\n" + "symbol = " + contract.m_symbol + "\n" + "secType = " +
contract.m_secType + "\n" + "cusip = " + cls.contractDetails.m_cusip + "\n"
+ "coupon = " + cls.contractDetails.m_coupon + "\n" + "maturity = " +
cls.contractDetails.m_maturity + "\n" + "issueDate = " +
cls.contractDetails.m_issueDate + "\n" + "ratings = " +
cls.contractDetails.m_ratings + "\n" + "bondType = " +
cls.contractDetails.m_bondType + "\n" + "couponType = " +
cls.contractDetails.m_couponType + "\n" + "convertible = " +
cls.contractDetails.m_convertible + "\n" + "callable = " +
cls.contractDetails.m_callable + "\n" + "putable = " +
cls.contractDetails.m_putable + "\n" + "descAppend = " +
cls.contractDetails.m_descAppend + "\n" + "exchange = " +
contract.m_exchange + "\n" + "currency = " + contract.m_currency + "\n"
+ "marketName = " + cls.contractDetails.m_marketName + "\n" + "tradingClass
= " + cls.contractDetails.m_tradingClass + "\n" + "conid = " +
contract.m_conId + "\n" + "minTick = " + cls.contractDetails.m_minTick
+ "\n" + "orderTypes = " + cls.contractDetails.m_orderTypes + "\n"
+ "validExchanges = " + cls.contractDetails.m_validExchanges + "\n"
+ "nextOptionDate = " + cls.contractDetails.m_nextOptionDate + "\n"
+ "nextOptionType = " + cls.contractDetails.m_nextOptionType + "\n"
+ "nextOptionPartial = " + cls.contractDetails.m_nextOptionPartial + "\n"
+ "notes = " + cls.contractDetails.m_notes + "\n" + " ---- Bond Contract
Details End ----\n"
return msg
@classmethod
+ def contractDetailsEnd(cls, reqId):
+ 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" + " ---- Execution
Details end ----\n"
+ 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"
return msg
@classmethod
@@ -217,5 +224,9 @@
@classmethod
def currentTime(cls, time):
return "current time = " + time + " (" +
DateFormat.getDateTimeInstance().format(Date(time * 1000)) + ")"
+
+ @classmethod
+ def fundamentalData(cls, reqId, data):
+ return "id = " + reqId + " len = " + len(data) + '\n' + data
Modified: trunk/ib/ext/Execution.py
==============================================================================
--- trunk/ib/ext/Execution.py (original)
+++ trunk/ib/ext/Execution.py Sat Aug 30 04:04:23 2008
@@ -30,6 +30,8 @@
m_price = float()
m_permId = 0
m_liquidation = 0
+ m_cumQty = 0
+ m_avgPrice = float()
@overloaded
def __init__(self):
@@ -39,8 +41,10 @@
self.m_price = 0
self.m_permId = 0
self.m_liquidation = 0
+ self.m_cumQty = 0
+ self.m_avgPrice = 0
- @__init__.register(object, int, int, str, str, str, str, str, int,
float, int, int)
+ @__init__.register(object, int, int, str, str, str, str, str, int,
float, int, int, int, float)
def __init___0(self, p_orderId,
p_clientId,
p_execId,
@@ -51,7 +55,9 @@
p_shares,
p_price,
p_permId,
- p_liquidation):
+ p_liquidation,
+ p_cumQty,
+ p_avgPrice):
self.m_orderId = p_orderId
self.m_clientId = p_clientId
self.m_execId = p_execId
@@ -63,6 +69,8 @@
self.m_price = p_price
self.m_permId = p_permId
self.m_liquidation = p_liquidation
+ self.m_cumQty = p_cumQty
+ self.m_avgPrice = p_avgPrice
def __eq__(self, p_other):
l_bRetVal = False
Modified: trunk/ib/ext/Order.py
==============================================================================
--- trunk/ib/ext/Order.py (original)
+++ trunk/ib/ext/Order.py Sat Aug 30 04:04:23 2008
@@ -87,8 +87,8 @@
m_deltaNeutralAuxPrice = float()
m_basisPoints = float()
m_basisPointsType = 0
- m_scaleNumComponents = 0
- m_scaleComponentSize = 0
+ m_scaleInitLevelSize = 0
+ m_scaleSubsLevelSize = 0
m_scalePriceIncrement = float()
m_account = ""
m_settlingFirm = ""
@@ -118,8 +118,8 @@
self.m_trailStopPrice = Double.MAX_VALUE
self.m_basisPoints = Double.MAX_VALUE
self.m_basisPointsType = Integer.MAX_VALUE
- self.m_scaleNumComponents = Integer.MAX_VALUE
- self.m_scaleComponentSize = Integer.MAX_VALUE
+ self.m_scaleInitLevelSize = Integer.MAX_VALUE
+ self.m_scaleSubsLevelSize = Integer.MAX_VALUE
self.m_scalePriceIncrement = Double.MAX_VALUE
self.m_whatIf = False
@@ -131,7 +131,7 @@
l_theOther = p_other
if (self.m_permId == l_theOther.m_permId):
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_scaleNumComponents !=
l_theOther.m_scaleNumComponents) or (self.m_scaleComponentSize !=
l_theOther.m_scaleComponentSize) or (self.m_scalePriceIncrement !=
l_theOther.m_scalePriceIncrement) or (self.m_whatIf != l_theOther.m_whatIf):
+ 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):
return False
Modified: trunk/ib/ext/TickType.py
==============================================================================
--- trunk/ib/ext/TickType.py (original)
+++ trunk/ib/ext/TickType.py Sat Aug 30 04:04:23 2008
@@ -65,6 +65,7 @@
CLOSE_EFP_COMPUTATION = 44
LAST_TIMESTAMP = 45
SHORTABLE = 46
+ FUNDAMENTAL_RATIOS = 47
@classmethod
def getField(cls, tickType):
@@ -162,6 +163,8 @@
return "lastTimestamp"
elif tickType == cls.SHORTABLE:
return "shortable"
+ elif tickType == cls.FUNDAMENTAL_RATIOS:
+ return "fundamentals"
else:
return "unknown"
Added: trunk/ib/ext/UnderComp.py
==============================================================================
--- (empty file)
+++ trunk/ib/ext/UnderComp.py Sat Aug 30 04:04:23 2008
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+##
+# Translated source for UnderComp.
+##
+
+# Source file: UnderComp.java
+# Target file: UnderComp.py
+#
+# Original file copyright original author(s).
+# This file copyright Troy Melhase, tr...@gci.net.
+#
+# WARNING: all changes to this file will be lost.
+
+
+class UnderComp(object):
+ """ generated source for UnderComp
+
+ """
+ m_conId = 0
+ m_delta = float()
+ m_price = float()
+
+ def __init__(self):
+ self.m_conId = 0
+ self.m_delta = 0
+ self.m_price = 0
+
+ def __eq__(self, p_other):
+ if self is p_other:
+ return True
+ if p_other is None or not isinstance(p_other, (UnderComp)):
+ return False
+ l_theOther = p_other
+ if (self.m_conId != l_theOther.m_conId):
+ return False
+ if (self.m_delta != l_theOther.m_delta):
+ return False
+ if (self.m_price != l_theOther.m_price):
+ return False
+ return True
+
+
Modified: trunk/ib/ext/cfg/Contract.py
==============================================================================
--- trunk/ib/ext/cfg/Contract.py (original)
+++ trunk/ib/ext/cfg/Contract.py Sat Aug 30 04:04:23 2008
@@ -6,6 +6,7 @@
modulePreamble = [
'from ib.lib.overloading import overloaded',
'from ib.lib import Cloneable',
+ 'from ib.ext.UnderComp import UnderComp',
'from ib.ext.Util import Util',
]
Modified: trunk/ib/ext/cfg/EReader.py
==============================================================================
--- trunk/ib/ext/cfg/EReader.py (original)
+++ trunk/ib/ext/cfg/EReader.py Sat Aug 30 04:04:23 2008
@@ -13,6 +13,7 @@
'from ib.ext.Order import Order',
'from ib.ext.OrderState import OrderState',
'from ib.ext.TickType import TickType',
+ 'from ib.ext.UnderComp import UnderComp',
'from ib.lib.logger import logger',
'',
'# micro optimizations',
Added: trunk/ib/ext/cfg/UnderComp.py
==============================================================================
--- (empty file)
+++ trunk/ib/ext/cfg/UnderComp.py Sat Aug 30 04:04:23 2008
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+""" ib.ext.cfg.UnderComp -> config module for UnderComp.java.
+
+"""