{ "info": { "author": "Ewald R. de Wit", "author_email": "ewald.de.wit@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: Freeware", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Office/Business :: Financial :: Investment" ], "description": "Notice\n======\n\nThis project has evolved into `IB-insync `_\nand all development is happening there now.\n\nTo port code:\n\n* ``TWSClient`` has moved to ``ib_insync.client.Client`` (with much improvements);\n* ``TWSClientQt``: The new ``Client`` can be used with PyQt and quamash.\n\nIntroduction\n============\n\nThe ``tws_async`` package allows the Python API from Interactive Brokers (IBAPI)\nto be used asynchronously and single-threaded with the\nasyncio_ standard library or with the PyQt5_ framework.\n\nThis offers a simpler, safer and more performant approach to concurrency than\nmultithreading.\n\n\nInstallation\n============\n\nInstall using pip::\n\n pip3 install -U tws_async\n\nNote that on some systems the ``pip3`` command is just ``pip``.\n\nPython_ version 3.5 or higher is required as well as the\n`Interactive Brokers Python API`_.\n\n\nUsage\n=====\n\nThis package offers two clients that can be used as a drop-in replacement for\nthe standard EClient as provided by IBAPI:\n\n* ``TWSClient``, for use with the asyncio event loop;\n* ``TWSClientQt``, for use with the PyQt5 event loop.\n\nThese clients also inherit from ``ibapi.wrapper.EWrapper`` and can be used exactly\nas one would use the standard IBAPI version. The asynchronous clients use\ntheir own event-driven networking code that replaces the networking code\nof the standard ``EClient``, and they also replace the infinite loop of\n``EClient.run()`` with an event loop.\n\nTo simplify working with contracts, this package provides\n``Contract``, ``Stock``, ``Option``, ``Future``, ``Forex``, ``Index``, ``CFD`` and ``Commodity``\nclasses that can be used anywhere where a ``ibapi.contract.Contract`` is expected.\nExamples of some simple cases are\n``Stock('AMD')``, ``Forex('EURUSD')``, ``CFD('IBUS30')`` or\n``Future('ES', '201612', 'GLOBEX')``.\nTo specify more complex contracts, any property can be given as a keyword.\n\nTo learn more, consult the `official IBAPI documentation`_ or have a look at\nthese sample use cases:\n\nHistorical data downloader\n--------------------------\nThe HistRequester_ downloads historical data and saves it to CSV files;\n`histrequester demo`_ illustrates how to use it.\n\nRealtime streaming ticks\n------------------------\nThe `tick streamer`_ subscribes to realtime tick data.\n\nJupyter Notebook\n----------------\nTo use the Interactive Brokers API fully interactively in a Jupyter notebook,\nhave a look at the `example notebook`_.\n\nJupyter can be started with the command ``jupyter notebook``.\n\nThis notebook uses the Qt version of the client, where the\nQt event loop is started with the ``%gui qt5`` directive at the very top.\nIt is not necessary to call the ``run()`` method of the client.\n\nNotes on using asycio in a notebook\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nCurrently there does not seem to be a single-threaded way to directly run\nthe asyncio event loop in Jupyter. What can be done is to use the\nQt event loop (which does have good integration with the Jupyter kernel)\nwith the quamash_ adaptor. With quamash the Qt event loop is used to drive\nthe asyncio event loop. This can be done by placing the following code at\nthe top of the notebook:\n\n.. code:: python\n\n %gui qt5\n import asyncio, quamash\n loop = quamash.QEventLoop()\n asyncio.set_event_loop(loop)\n\nOne thing that does not work in the combination of quamash and Jupyter is the\n``loop.run_until_finished`` method. It can be patched like this:\n\n.. code:: python\n\n def run_until_complete(self, future):\n future = asyncio.ensure_future(future)\n qApp = qt.QApplication.instance()\n while not future.done():\n qApp.processEvents(qt.QEventLoop.WaitForMoreEvents)\n return future.result()\n\n quamash.QEventLoop.run_until_complete = run_until_complete\n\nThe asyncio version of the client relies on ``loop.run_until_finished`` to connect\nsynchonously. So in order to run the asyncio client in the notebook, apply the patch\nor just connect asynchonously (i.e. give asyncConnect=True to the connect call).\n\nChangelog\n=========\n\nVersion 0.5.7\n-------------\n\n* HistRequester fix for endDateTime formatting\n\nVersion 0.5.6\n-------------\n\n* HistRequester updated to version 9.73.04 of the API\n\nVersion 0.5.5\n-------------\n* small simplifications\n\nVersion 0.5.4\n-------------\n* connect() call of the clients will now by default block until client is ready to serve requests.\n* getReqId() method added to both clients.\n* dataHandlingPre() and dataHandlingPost() event hooks added to clients.\n* logging added.\n* util module aded.\n* file tws_async.py renamed to twsclient.py, tws_asyncqt.py to twsclientqt.py.\n\n\nVersion 0.5.3\n-------------\n* Added optional ``asyncConnect`` argument to ``client.connect()`` method. The default is now to connect synchronously (block until connected).\n* Fixed bug in HistRequester when downloading daily data.\n\nVersion 0.5.0\n-------------\n* Initial pip package release.\n\nGood luck and enjoy,\n\n:author: Ewald de Wit \n\n.. _asyncio: https://docs.python.org/3.6/library/asyncio.html\n.. _PyQt5: https://pypi.python.org/pypi/PyQt5\n.. _Python: http://www.python.org\n.. _`Interactive Brokers Python API`: http://interactivebrokers.github.io\n.. _`official IBAPI documentation`: https://interactivebrokers.github.io/tws-api/#gsc.tab=0\n.. _quamash: https://github.com/harvimt/quamash\n.. _`HistRequester`: https://github.com/erdewit/tws_async/blob/master/tws_async/histrequester.py\n.. _`histrequester demo`: https://github.com/erdewit/tws_async/blob/master/samples/histrequester_demo.py\n.. _`tick streamer`: https://github.com/erdewit/tws_async/blob/master/samples/tickstreamer_demo.py\n.. _`example notebook`: https://github.com/erdewit/tws_async/blob/master/samples/tws.ipynb\n\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/erdewit/tws_async", "keywords": "ibapi asyncio qt pyqt pyqt5 jupyter interactive brokers async", "license": "Freeware", "maintainer": "", "maintainer_email": "", "name": "tws-async", "package_url": "https://pypi.org/project/tws-async/", "platform": "", "project_url": "https://pypi.org/project/tws-async/", "project_urls": { "Homepage": "https://github.com/erdewit/tws_async" }, "release_url": "https://pypi.org/project/tws-async/0.5.7/", "requires_dist": [ "PyQt5", "jupyter", "numpy", "pandas", "pytz", "quamash", "seaborn" ], "requires_python": "", "summary": "Use the Interactive Brokers API (IBAPI) asynchonouslywith asyncio or PyQt5", "version": "0.5.7" }, "last_serial": 3345999, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "60d11e1afc0d2301a89b82c35536d066", "sha256": "c01d375f7ebab60b775701dffbd71f3d6b86eaf459ebbf1c3391c157c204bf19" }, "downloads": -1, "filename": "tws_async-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "60d11e1afc0d2301a89b82c35536d066", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13872, "upload_time": "2017-06-21T22:49:28", "url": "https://files.pythonhosted.org/packages/c8/72/646fe3d5ab8418e6a7959a3617af802f677734397b8553a4c9f265a38630/tws_async-0.5.0-py3-none-any.whl" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "fba06e7c058d6089cb4801048d415748", "sha256": "5fa9686306c27147c34b15c88ad649759f22bfb2b08920e4d732504cf15db46f" }, "downloads": -1, "filename": "tws_async-0.5.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fba06e7c058d6089cb4801048d415748", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 51048, "upload_time": "2017-06-22T09:52:47", "url": "https://files.pythonhosted.org/packages/fb/e4/1ed2b563d677d0bc3580c080d1acd2870bf63a152c486d24c4b08b14f3f6/tws_async-0.5.1-py3-none-any.whl" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "7db173ff22b4c4951fe15ee557eca831", "sha256": "114b7a7a809fbdb4f2946f888d2eb5fc817430195e54e9acae8884c2dab57f90" }, "downloads": -1, "filename": "tws_async-0.5.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7db173ff22b4c4951fe15ee557eca831", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 51052, "upload_time": "2017-06-22T09:58:18", "url": "https://files.pythonhosted.org/packages/24/89/228228c1ddc54dee9e39084e5a822fda6d26f96548a3ba9082528c8ae7a2/tws_async-0.5.2-py3-none-any.whl" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "780e7075ad04d7b60e5901b41ff67e8f", "sha256": "bd17b8ea8f70392e501c4a7f709263abfb6fdaee6766bb8b6140b7fc0496318d" }, "downloads": -1, "filename": "tws_async-0.5.3-py3-none-any.whl", "has_sig": false, "md5_digest": "780e7075ad04d7b60e5901b41ff67e8f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 51720, "upload_time": "2017-06-22T18:00:19", "url": "https://files.pythonhosted.org/packages/42/21/3a04af58f6dc776d7b03cda3c5d6c6aa4f81e85fb9ffc263fc8fd88fd92a/tws_async-0.5.3-py3-none-any.whl" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "b57e6da49cf327f871c34bc42baf92ca", "sha256": "3aca100df013bd1f61064a14afb15e7920ac31c76a1c5f8747c32cd1baeca7ea" }, "downloads": -1, "filename": "tws_async-0.5.4-py3-none-any.whl", "has_sig": false, "md5_digest": "b57e6da49cf327f871c34bc42baf92ca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 57564, "upload_time": "2017-06-23T20:31:19", "url": "https://files.pythonhosted.org/packages/f5/70/0ccbc41bfda522971cf9f4c567f0434c0a00908a90a1ab4e0c4c13b5ced0/tws_async-0.5.4-py3-none-any.whl" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "7ae6bd3a12f51a1f47379e2f827d6c17", "sha256": "4b517519f33483596fbd85eb6fe0737ae380d7ecb5e6a4ad1c370d63f841e47d" }, "downloads": -1, "filename": "tws_async-0.5.5-py3-none-any.whl", "has_sig": false, "md5_digest": "7ae6bd3a12f51a1f47379e2f827d6c17", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 54215, "upload_time": "2017-06-23T21:01:57", "url": "https://files.pythonhosted.org/packages/f1/76/3b4d3506f00fc987c49ec7b00cf798675e3312b40d20599a826019af68c0/tws_async-0.5.5-py3-none-any.whl" } ], "0.5.6": [ { "comment_text": "", "digests": { "md5": "06586ef344c99f73973773823f399b9e", "sha256": "324e2c7c5524e268d5ba8c8790d0554bd97262b3912cdaaa77a7ad0e57b4425c" }, "downloads": -1, "filename": "tws_async-0.5.6-py3-none-any.whl", "has_sig": false, "md5_digest": "06586ef344c99f73973773823f399b9e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25798, "upload_time": "2017-11-12T09:43:16", "url": "https://files.pythonhosted.org/packages/9f/d4/0ba11201bc46f63b679becc46e013e1904e8c244731978cf0336851ef90e/tws_async-0.5.6-py3-none-any.whl" } ], "0.5.7": [ { "comment_text": "", "digests": { "md5": "08d8d918e8c101c0f4b6ce37a0c1632e", "sha256": "937d88d936e7233082b1e1068ab1cfdf7c2438e40e76ca89e4039c45618a5f5a" }, "downloads": -1, "filename": "tws_async-0.5.7-py3-none-any.whl", "has_sig": false, "md5_digest": "08d8d918e8c101c0f4b6ce37a0c1632e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25814, "upload_time": "2017-11-19T16:44:39", "url": "https://files.pythonhosted.org/packages/30/2e/f2eb8002b07976aa91f408a97e9ce8172c525183a89488e21fe51a053860/tws_async-0.5.7-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08d8d918e8c101c0f4b6ce37a0c1632e", "sha256": "937d88d936e7233082b1e1068ab1cfdf7c2438e40e76ca89e4039c45618a5f5a" }, "downloads": -1, "filename": "tws_async-0.5.7-py3-none-any.whl", "has_sig": false, "md5_digest": "08d8d918e8c101c0f4b6ce37a0c1632e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25814, "upload_time": "2017-11-19T16:44:39", "url": "https://files.pythonhosted.org/packages/30/2e/f2eb8002b07976aa91f408a97e9ce8172c525183a89488e21fe51a053860/tws_async-0.5.7-py3-none-any.whl" } ] }