From b65e0e263b3693b7d4ac24e7210df6c0e086372c Mon Sep 17 00:00:00 2001 From: Felix Zumstein Date: Wed, 19 Oct 2016 17:56:37 +0200 Subject: [PATCH 1/4] simplified build process/version number --- .README.in | 129 ------------------------------------------------- Makefile | 70 --------------------------- ib/__init__.py | 5 +- setup.py | 32 +++++++----- 4 files changed, 20 insertions(+), 216 deletions(-) delete mode 100644 .README.in delete mode 100644 Makefile diff --git a/.README.in b/.README.in deleted file mode 100644 index cf4681b..0000000 --- a/.README.in +++ /dev/null @@ -1,129 +0,0 @@ -IbPy - Interactive Brokers Python API -============================================================================== -IbPy Released :release_date: - - -What is IbPy? ------------------------------------------------------------------------------- -IbPy is a third-party implementation of the API used for accessing the -Interactive Brokers on-line trading system. IbPy implements functionality that -the Python programmer can use to connect to IB, request stock ticker data, -submit orders for stocks and futures, and more. - - -What's new in this release? ------------------------------------------------------------------------------- - - * TWS API version :twsapi_ver: now supported - * Over 60% test coverage and growing - * Fixed outstanding bugs in EReader generated source - * Module ib.opt.logger moved to ib.lib.logger - * Class ib.opt.Connection moved to new ib.opt.connection module - * Added script to filter TWS log files; see `demo/log_filter` - * Added ib.sym package to hold various symbolic constants - * Many small enhancements to ib.opt package - * Python 3 support - - -Where can I get IbPy? ------------------------------------------------------------------------------- -GitHub: - - https://github.com/blampe/IbPy - -Older versions of IbPy are available for download from Google Code: - - https://code.google.com/p/ibpy/downloads/list - -Project page: - - http://code.google.com/p/ibpy/ - - -How do I use IbPy? ------------------------------------------------------------------------------- -See the IbPy wiki page "Getting Started with IbPy": - - http://code.google.com/p/ibpy/wiki/GettingStarted - - -What are the requirements? ------------------------------------------------------------------------------- -IbPy requires Python 2.5 or newer. Previous versions are not supported. - -TWS requires a web browser capable of executing Sun(R) Java(tm) applets. TWS -can also be started directly with Sun(R) Java(tm) and the stand-alone package -supplied by Interactive Brokers. - - -What is Interactive Brokers? ------------------------------------------------------------------------------- -From the page "About The Interactive Brokers Group" [2]: - -> Interactive Brokers conducts its broker/dealer and proprietary trading -> businesses on 60 market centers worldwide. In its broker dealer agency -> business, IB provides direct access ("on line") trade execution and clearing -> services to institutional and professional traders for a wide variety of -> electronically traded products including options, futures, stocks, forex, and -> bonds worldwide. In its proprietary trading business IB engages in market -> making for its own account in about 6,500 different electronically traded -> products. Interactive Brokers Group and its affiliates now trade 19% of the -> world’s exchange traded equity options, and executes approximately 500,000 -> trades per day. - - -What is Python? ------------------------------------------------------------------------------- -From the page "What is Python?" [1]: - -> Python is an interpreted, interactive, object-oriented programming language. -> It is often compared to Tcl, Perl, Scheme or Java. - -> Python combines remarkable power with very clear syntax. It has modules, -> classes, exceptions, very high level dynamic data types, and dynamic typing. -> There are interfaces to many system calls and libraries, as well as to -> various windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules -> are easily written in C or C++. Python is also usable as an extension -> language for applications that need a programmable interface. - -> The Python implementation is portable: it runs on many brands of UNIX, on -> Windows, DOS, OS/2, Mac, Amiga... If your favorite system isn't listed here, -> it may still be supported, if there's a C compiler for it. Ask around on -> comp.lang.python -- or just try compiling Python yourself. - -> The Python implementation is copyrighted but freely usable and distributable, -> even for commercial use. - - -What Else? ------------------------------------------------------------------------------- -IbPy is not a product of Interactive Brokers, nor is this project affiliated -with IB. - -IbPy is installed with distutils. Refer to the Python distutils documentation -for more information. The digest version is: - - $ tar xzf :release_file: - $ cd :release_root: - $ python setup.py install - -The TWS demo system is available here: - - http://interactivebrokers.com/cgi-pub/jtslink.pl?user_name=edemo - -The stand-alone TWS and other API software is available from IB: - - http://interactivebrokers.com/ - -IbPy is distributed under the New BSD License. See the LICENSE file in the -release for details. - -I'm very interested in your experience with IbPy. Please drop me an note with -any feedback you have. - - -Troy Melhase - - -[1]: http://www.interactivebrokers.com/en/general/about/about.php -[2]: http://python.org/doc/Summary.html diff --git a/Makefile b/Makefile deleted file mode 100644 index 9fafae4..0000000 --- a/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -## -## This is the IbPy distribution Makefile. Use this file to build a -## source distribution only after the source has been edited, remade, -## and checked into the repository. -## -## To build a source distribution, run: -## -## make dist -## - - -ibpy_ver := 0.8.0 -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) -release_dir := release-$(release_num) -release_date := $(shell date +"%d %b %Y") -release_root := IbPy-$(release_num) -release_file := $(release_root).tar.gz -svn_root := http://ibpy.googlecode.com/svn/trunk - -.PHONY: all clean test - - -.SILENT: clean $(release_dir) - - -all: dist - -test: - PYTHONPATH=. ./demo/api_coverage - -tests: test - - -clean: - $(if $(wildcard $(release_dir)), echo [W] removing release directory $(release_dir)). - rm -rf $(release_dir) - - -dist: $(release_dir) - -README.mkd: - sed s/\:release_num\:/$(release_num)/ .README.in > README.mkd - sed -i '.bak' s/\:release_date\:/"$(release_date)"/ README.mkd - sed -i '.bak' s/\:twsapi_ver\:/$(twsapi_ver)/ README.mkd - sed -i '.bak' s/\:release_file\:/$(release_file)/ README.mkd - sed -i '.bak' s/\:release_root\:/$(release_root)/ README.mkd - mv README.mkd.bak README.mkd - -$(release_dir): README.mkd - 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 - cd $(release_dir)/ib && sed -i '.bak' s/revision\ \=\ \"r0\"/revision\ \=\ \"r$(ibpy_rev)\"/ __init__.py - cd $(release_dir) && mv setup.py.in setup.py - cd $(release_dir)/ && sed -i '.bak' s/version\ \=\ \"0\"/version\ \=\ \"$(release_num)\"/ setup.py - cd $(release_dir)/ && sed -i '.bak' s/\:release_file\:/$(release_file)/ setup.py - cp README.mkd $(release_dir)/README - echo [I] building source distribution - cd $(release_dir) && python setup.py sdist --formats=gztar,zip > /dev/null - echo [I] source distribution complete. files in ./$(release_dir)/dist/ - ls $(release_dir)/dist - diff --git a/ib/__init__.py b/ib/__init__.py index 430da2e..051e01a 100644 --- a/ib/__init__.py +++ b/ib/__init__.py @@ -6,9 +6,6 @@ # ## -# these values substituted during release build. -api = "0" -version = "0" -revision = "r0" +__version__ = '0.8.0' diff --git a/setup.py b/setup.py index 259c6b3..47e873d 100755 --- a/setup.py +++ b/setup.py @@ -7,6 +7,8 @@ that the Python programmer can use to connect to IB, request stock ticker data, submit orders for stocks and options, and more. """ +import os +import re from distutils.core import setup @@ -27,23 +29,27 @@ doclines = __doc__.split('\n') +# Version Number +with open(os.path.join(os.path.dirname(__file__), 'ib', '__init__.py')) as f: + version = re.compile(r".*__version__ = '(.*?)'", re.S).match(f.read()).group(1) + try: # Python 3 from distutils.command.build_py import build_py_2to3 as build_py except ImportError: # Python 2 from distutils.command.build_py import build_py -setup(cmdclass = {'build_py': build_py}, - name = 'IbPy', - version = "0", # make value - description = doclines[0], - author = 'Troy Melhase', - author_email = 'troy@gci.net', - url = 'http://code.google.com/p/ibpy/', - license = 'BSD License', - packages = ['ib', 'ib/lib', 'ib/ext', 'ib/opt', 'ib/sym'], - classifiers = filter(None, classifiers.split('\n')), - long_description = '\n'.join(doclines[2:]), - platforms = ['any'], - download_url = 'http://ibpy.googlecode.com/files/:release_file:', +setup( + cmdclass={'build_py': build_py}, + name='IbPy2', + version=version, + description=doclines[0], + author='Troy Melhase', + author_email='troy@gci.net', + url='https://github.com/blampe/IbPy', + license='BSD License', + packages=['ib', 'ib/lib', 'ib/ext', 'ib/opt', 'ib/sym'], + classifiers=filter(None, classifiers.split('\n')), + long_description='\n'.join(doclines[2:]), + platforms=['any'] ) From 05e73215da144685c7fc2f10412d0819b36dee54 Mon Sep 17 00:00:00 2001 From: Felix Zumstein Date: Wed, 19 Oct 2016 17:56:55 +0200 Subject: [PATCH 2/4] updated readme and factored out changelog --- README.md | 52 +++++++++++++++++++++ README.mkd | 128 --------------------------------------------------- changelog.md | 15 ++++++ 3 files changed, 67 insertions(+), 128 deletions(-) create mode 100644 README.md delete mode 100644 README.mkd create mode 100644 changelog.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e65db8 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# IbPy - Interactive Brokers Python API + +## What is IbPy? + +IbPy is a third-party implementation of the API used for accessing the +Interactive Brokers online trading system. IbPy implements functionality that +the Python programmer can use to connect to IB, request stock ticker data, +submit orders for stocks and futures, and more. + +## Installation + +There is a package maintained on PyPI under the name IbPy2, it's version is in sync +with the tags on GitHub. + +``` +pip install IbPy2 +``` + +Alternatively, it can be installed from source. From within the IbPy directory, execute: + +``` +python setup.py install +``` + +Pip also supports installing directly from GitHub, e.g. if you want commit `83b9d08ed9c850d840a6700d0fb9c3ca164f9bff`, use + +``` +pip install git+https://github.com/blampe/IbPy@83b9d08ed9c850d840a6700d0fb9c3ca164f9bff +``` + +## How do I use IbPy? + +See the IbPy wiki page https://github.com/blampe/IbPy/wiki/Getting-Started + +## What are the requirements? + +* Python >2.5 or >3.3. Previous versions are not supported. +* Either a running instance of Trader Workstation (TWS) or IB Gateway. + +## License + +IbPy is distributed under the New BSD License. See the LICENSE file in the +release for details. + +## Note + +IbPy is not a product of Interactive Brokers, nor is this project affiliated +with IB. + +## Source code + +https://github.com/blampe/IbPy \ No newline at end of file diff --git a/README.mkd b/README.mkd deleted file mode 100644 index 4392acb..0000000 --- a/README.mkd +++ /dev/null @@ -1,128 +0,0 @@ -IbPy - Interactive Brokers Python API -============================================================================== -IbPy Released 15 Jun 2013 - - -What is IbPy? ------------------------------------------------------------------------------- -IbPy is a third-party implementation of the API used for accessing the -Interactive Brokers on-line trading system. IbPy implements functionality that -the Python programmer can use to connect to IB, request stock ticker data, -submit orders for stocks and futures, and more. - - -What's new in this release? ------------------------------------------------------------------------------- - - * TWS API version 9.70 now supported - * Over 60% test coverage and growing - * Fixed outstanding bugs in EReader generated source - * Module ib.opt.logger moved to ib.lib.logger - * Class ib.opt.Connection moved to new ib.opt.connection module - * Added script to filter TWS log files; see `demo/log_filter` - * Added ib.sym package to hold various symbolic constants - * Many small enhancements to ib.opt package - - -Where can I get IbPy? ------------------------------------------------------------------------------- -GitHub: - - https://github.com/blampe/IbPy - -Older versions of IbPy are available for download from Google Code: - - https://code.google.com/p/ibpy/downloads/list - -Project page: - - http://code.google.com/p/ibpy/ - - -How do I use IbPy? ------------------------------------------------------------------------------- -See the IbPy wiki page "Getting Started with IbPy": - - http://code.google.com/p/ibpy/wiki/GettingStarted - - -What are the requirements? ------------------------------------------------------------------------------- -IbPy requires Python 2.5 or newer. Previous versions are not supported. - -TWS requires a web browser capable of executing Sun(R) Java(tm) applets. TWS -can also be started directly with Sun(R) Java(tm) and the stand-alone package -supplied by Interactive Brokers. - - -What is Interactive Brokers? ------------------------------------------------------------------------------- -From the page "About The Interactive Brokers Group" [2]: - -> Interactive Brokers conducts its broker/dealer and proprietary trading -> businesses on 60 market centers worldwide. In its broker dealer agency -> business, IB provides direct access ("on line") trade execution and clearing -> services to institutional and professional traders for a wide variety of -> electronically traded products including options, futures, stocks, forex, and -> bonds worldwide. In its proprietary trading business IB engages in market -> making for its own account in about 6,500 different electronically traded -> products. Interactive Brokers Group and its affiliates now trade 19% of the -> world’s exchange traded equity options, and executes approximately 500,000 -> trades per day. - - -What is Python? ------------------------------------------------------------------------------- -From the page "What is Python?" [1]: - -> Python is an interpreted, interactive, object-oriented programming language. -> It is often compared to Tcl, Perl, Scheme or Java. - -> Python combines remarkable power with very clear syntax. It has modules, -> classes, exceptions, very high level dynamic data types, and dynamic typing. -> There are interfaces to many system calls and libraries, as well as to -> various windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules -> are easily written in C or C++. Python is also usable as an extension -> language for applications that need a programmable interface. - -> The Python implementation is portable: it runs on many brands of UNIX, on -> Windows, DOS, OS/2, Mac, Amiga... If your favorite system isn't listed here, -> it may still be supported, if there's a C compiler for it. Ask around on -> comp.lang.python -- or just try compiling Python yourself. - -> The Python implementation is copyrighted but freely usable and distributable, -> even for commercial use. - - -What Else? ------------------------------------------------------------------------------- -IbPy is not a product of Interactive Brokers, nor is this project affiliated -with IB. - -IbPy is installed with distutils. Refer to the Python distutils documentation -for more information. The digest version is: - - $ tar xzf IbPy-0.8.0-9.67.tar.gz - $ cd :release_root: - $ python setup.py install - -The TWS demo system is available here: - - http://interactivebrokers.com/cgi-pub/jtslink.pl?user_name=edemo - -The stand-alone TWS and other API software is available from IB: - - http://interactivebrokers.com/ - -IbPy is distributed under the New BSD License. See the LICENSE file in the -release for details. - -I'm very interested in your experience with IbPy. Please drop me an note with -any feedback you have. - - -Troy Melhase - - -[1]: http://www.interactivebrokers.com/en/general/about/about.php -[2]: http://python.org/doc/Summary.html diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..5f04861 --- /dev/null +++ b/changelog.md @@ -0,0 +1,15 @@ +# v0.8.0 + +* Some internal reorganization +* Made available as IbPy2 in PyPI + +# Pre v0.8.0 + +* TWS API version 9.70 now supported +* Over 60% test coverage and growing +* Fixed outstanding bugs in EReader generated source +* Module ib.opt.logger moved to ib.lib.logger +* Class ib.opt.Connection moved to new ib.opt.connection module +* Added script to filter TWS log files; see `demo/log_filter` +* Added ib.sym package to hold various symbolic constants +* Many small enhancements to ib.opt package \ No newline at end of file From 5d8a0f81ffe8836bfef9d7d1f4db5d86460eed19 Mon Sep 17 00:00:00 2001 From: Felix Zumstein Date: Wed, 19 Oct 2016 17:57:10 +0200 Subject: [PATCH 3/4] added .py endings to demo files --- demo/{api_coverage => api_coverage.py} | 0 demo/{example_opt => example_opt.py} | 0 demo/{fancy_marketdata => fancy_marketdata.py} | 0 demo/{filters => filters.py} | 0 demo/{log_filter => log_filter.py} | 0 demo/{option_order_data => option_order_data.py} | 0 demo/{reference_jython => reference_jython.py} | 0 demo/{reference_python => reference_python.py} | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename demo/{api_coverage => api_coverage.py} (100%) rename demo/{example_opt => example_opt.py} (100%) rename demo/{fancy_marketdata => fancy_marketdata.py} (100%) rename demo/{filters => filters.py} (100%) rename demo/{log_filter => log_filter.py} (100%) rename demo/{option_order_data => option_order_data.py} (100%) rename demo/{reference_jython => reference_jython.py} (100%) rename demo/{reference_python => reference_python.py} (100%) diff --git a/demo/api_coverage b/demo/api_coverage.py similarity index 100% rename from demo/api_coverage rename to demo/api_coverage.py diff --git a/demo/example_opt b/demo/example_opt.py similarity index 100% rename from demo/example_opt rename to demo/example_opt.py diff --git a/demo/fancy_marketdata b/demo/fancy_marketdata.py similarity index 100% rename from demo/fancy_marketdata rename to demo/fancy_marketdata.py diff --git a/demo/filters b/demo/filters.py similarity index 100% rename from demo/filters rename to demo/filters.py diff --git a/demo/log_filter b/demo/log_filter.py similarity index 100% rename from demo/log_filter rename to demo/log_filter.py diff --git a/demo/option_order_data b/demo/option_order_data.py similarity index 100% rename from demo/option_order_data rename to demo/option_order_data.py diff --git a/demo/reference_jython b/demo/reference_jython.py similarity index 100% rename from demo/reference_jython rename to demo/reference_jython.py diff --git a/demo/reference_python b/demo/reference_python.py similarity index 100% rename from demo/reference_python rename to demo/reference_python.py From a68709d590ffea3ccbaf6f91fcf49b74d640f1d6 Mon Sep 17 00:00:00 2001 From: Felix Zumstein Date: Wed, 19 Oct 2016 18:09:11 +0200 Subject: [PATCH 4/4] fixed classifiers, changed author by maintainer --- setup.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 47e873d..b635b3a 100755 --- a/setup.py +++ b/setup.py @@ -12,8 +12,7 @@ from distutils.core import setup -classifiers = """ -Development Status :: 5 - Production/Stable +classifiers = """Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: OSI Approved :: BSD License Natural Language :: English @@ -23,8 +22,7 @@ Topic :: Office/Business :: Financial :: Investment Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator Topic :: Software Development :: Libraries -Topic :: Software Development :: Libraries :: Python Modules -""" +Topic :: Software Development :: Libraries :: Python Modules""" doclines = __doc__.split('\n') @@ -44,12 +42,12 @@ name='IbPy2', version=version, description=doclines[0], - author='Troy Melhase', - author_email='troy@gci.net', + maintainer='Felix Zumstein', + maintainer_email='felix.zumstein@zoomeranalytics.com', url='https://github.com/blampe/IbPy', license='BSD License', packages=['ib', 'ib/lib', 'ib/ext', 'ib/opt', 'ib/sym'], - classifiers=filter(None, classifiers.split('\n')), + classifiers=classifiers.split('\n'), long_description='\n'.join(doclines[2:]), platforms=['any'] )