Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix api_coverage tickerId crash refs #9

  • Loading branch information...
commit 47ca450b1dc6ef2de32e28933d69c7fa5a4f10d3 1 parent 8ee2aa9
@blampe authored
View
3  Makefile
@@ -40,6 +40,9 @@ $(release_dir):
echo [I] building release=$(release_num) version=$(ibpy_ver) revision=$(ibpy_rev) api=$(twsapi_ver).
echo [I] exporting source from $(svn_root) into $(release_dir).
svn export $(svn_root) $(release_dir) > /dev/null
+ echo [I] overwriting ib/ and demo/ with local source
+ cp -r ib/ $(release_dir)/ib
+ cp -r demo/ $(release_dir)/demo
echo [I] fixing version strings
cd $(release_dir)/ib && sed -i '.bak' s/api\ \=\ \"0\"/api\ \=\ \"$(twsapi_ver)\"/ __init__.py
cd $(release_dir)/ib && sed -i '.bak' s/version\ \=\ \"0\"/version\ \=\ \"$(release_num)\"/ __init__.py
View
0  README.in → README
File renamed without changes
View
11 demo/api_coverage
@@ -9,9 +9,10 @@
# it an example of correct use of a programming language.
#
##
+import logging
+
from functools import partial
from logging import DEBUG, INFO, WARN, ERROR
-from logging import debug, info, warn, error, root
from optparse import OptionParser
from random import randint
from time import sleep, strftime, time
@@ -137,11 +138,11 @@ def make_error_catcher(seq):
def maybe_verbose(call):
name = call.__name__
def inner(connection, options):
- info('Start %s', name)
+ logging.info('Start %s', name)
start = time()
v = call(connection, options)
finish = time()
- info('Finish %s in %0.3f sec', name, finish-start)
+ logging.info('Finish %s in %0.3f sec', name, finish-start)
return v
inner.__name__ = name
return inner
@@ -152,7 +153,7 @@ def catch_errors(call):
errors = []
catcher = make_error_catcher(errors)
connection.register(catcher, 'Error')
- rv = call(connection, options)
+ call(connection, options)
connection.unregister(catcher, 'Error')
return errors
inner.__name__ = call.__name__
@@ -330,7 +331,7 @@ def get_options():
def main(options):
basicConfig()
- root.setLevel(verbose_levels.get(options.verbose, ERROR))
+ logging.root.setLevel(verbose_levels.get(options.verbose, ERROR))
rec_msgs = {}
unrec_msgs = {}
View
0  demo/fancy_marketdata 100644 → 100755
File mode changed
View
41 ib/opt/sender.py
@@ -27,8 +27,8 @@ def __init__(self, dispatcher):
@param dispatcher message dispatcher instance
"""
- self.dispatcher = dispatcher
- self.clientMethodNames = [m[0] for m in clientSocketMethods]
+ self.dispatcher = dispatcher
+ self.clientMethodNames = [m[0] for m in clientSocketMethods]
def connect(self, host, port, clientId, handler, clientType=EClientSocket):
""" Creates a TWS client socket and connects it.
@@ -63,24 +63,23 @@ def __getattr__(self, name):
@return named attribute from EClientSocket object
"""
- try:
- value = getattr(self.client, name)
- except (AttributeError, ):
- raise
- if name not in self.clientMethodNames:
- return value
+ try:
+ value = getattr(self.client, name)
+ except (AttributeError, ):
+ raise
+ if name not in self.clientMethodNames:
+ return value
return value
- typeName = toTypeName(name)
- preName, postName = name+'Pre', name+'Post'
- preType, postType = registry[preName], registry[postName]
- @wraps(value)
- def wrapperMethod(*args):
- mapping = dict(zip(preType.__slots__, args))
- results = self.dispatcher(preName, mapping)
- if not all(results):
- return # raise exception instead?
- result = value(*args)
- self.dispatcher(postName, mapping)
- return result # or results?
- return wrapperMethod
+ preName, postName = name+'Pre', name+'Post'
+ preType, postType = registry[preName], registry[postName]
+ @wraps(value)
+ def wrapperMethod(*args):
+ mapping = dict(zip(preType.__slots__, args))
+ results = self.dispatcher(preName, mapping)
+ if not all(results):
+ return # raise exception instead?
+ result = value(*args)
+ self.dispatcher(postName, mapping)
+ return result # or results?
+ return wrapperMethod
View
0  setup.py.in → setup.py
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.