import sys if sys.version_info < (3, 6, 0): raise RuntimeError("ibstract requires Python 3.6.0 or higher") try: import ibapi except ImportError: print('Interactive Brokers API >= 9.73 is required') sys.exit() ibver = tuple(ibapi.VERSION.values()) if ibver < (9, 73, 2): print("\nInteractive Brokers API version: %s installed." "\nInteractive Brokers API Version >= 9.73.2 required." % ibapi.get_version_string()) from .brokers import * from .marketdata import * from .financedata import * from .trading import * from .ibglobals import * from . import utils __version__ = '1.0.0a2' __all__ = ['utils'] for _m in (brokers, marketdata, financedata, trading, ibglobals): __all__ += _m.__all__
""" Copyright (C) 2018 Interactive Brokers LLC. All rights reserved. This code is subject to the terms and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. """ #from distutils.core import setup from setuptools import setup from ibapi import get_version_string import sys if sys.version_info < (3, 1): sys.exit("Only Python 3.1 and greater is supported") setup(name='ibapi', version=get_version_string(), packages=['ibapi'], url='https://interactivebrokers.github.io/tws-api', license='IB API Non-Commercial License or the IB API Commercial License', author='IBG LLC', author_email='*****@*****.**', description='Python IB API')
if os.name == "nt": alternate_path = "C:\\TWS API\\source\\pythonclient" else: alternate_path = "/opt/twsapi/pythonclient" try: import ibapi except ImportError: try: sys.path.append(alternate_path) import ibapi except ImportError: sys.stderr.write("twsapi 973.05 must be installed under a system path or '{0}'\n".format(alternate_path)) sys.exit(1) tws_api_ver = StrictVersion(ibapi.get_version_string()) tws_req_ver = StrictVersion("9.73.2") if tws_api_ver != tws_req_ver: sys.stderr.write("twsapi version '{0}' required, version installed is '{1}'\n".format(tws_req_ver, tws_api_ver)) sys.exit(1) # Import our modules script_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(script_dir + "/../lib/") from client import ClientApp def main(): # Connect to the paper account port port = 7497