Interactive Brokers Python API
Project description
ibapi
Automated publisher for the Interactive Brokers TWS API Python client on PyPI.
๐ฆ Installation
Two packages available on PyPI:
Latest Version (Recommended)
pip install ibapi-latest
Stable Version
pip install ibapi-stable
You can also install a specific version:
pip install ibapi-latest==10.40.01
pip install ibapi-stable==10.37.02
๐ Usage
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
class IBApp(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)
app = IBApp()
app.connect("127.0.0.1", 7497, clientId=1)
app.run()
For complete examples and documentation, visit the official IB API documentation.
๐ About This Package
This is an unofficial automated publisher for the Interactive Brokers TWS API Python client. The source code is from Interactive Brokers' official TWS API distribution, packaged and published to PyPI for easy installation.
โ ๏ธ DISCLAIMER
This package is NOT officially affiliated with, endorsed by, or supported by Interactive Brokers LLC. It is an independent community project that automates the packaging and distribution of the official IB API source code.
- The IB API source code is proprietary to Interactive Brokers and is licensed under the TWS API Non-Commercial License
- This automation tool is provided "as is" without any warranties
- For official support, please contact Interactive Brokers
- Trading involves risk. Use at your own discretion.
Two PyPI Packages
ibapi-latest: The newest IB API version (frommainbranch)ibapi-stable: Previous IB API versions (fromstablebranch)
Both packages are automatically updated weekly when new IB API versions are released.
๐๏ธ Project Structure
ibapi/
โโโ .github/
โ โโโ workflows/ # GitHub Actions for automation
โ โโโ update-ibapi-latest.yml # Latest version publisher
โ โโโ update-ibapi-stable.yml # Stable version publisher
โโโ scripts/ # Automation scripts
โ โโโ get_download_url.py # Fetch IB API download URLs
โ โโโ update_ibapi.py # Download and commit IB API
โ โโโ check_and_update.py # Orchestrator (legacy)
โโโ ibapi/ # IB API Python client (auto-updated)
โ โโโ ibapi/
โ โโโ client.py
โ โโโ wrapper.py
โ โโโ ...
โโโ pyproject.toml # Package configuration
โโโ README.md
๐ How It Works
Automated Workflow
- Weekly Check: GitHub Actions runs every Monday at 9:00 AM UTC
- Version Detection: Scrapes https://interactivebrokers.github.io/ for new versions
- Download & Extract: Downloads the TWS API zip and extracts the Python client
- Auto-Fix: Automatically fixes version strings and package configuration
- Build & Publish: Builds the package and publishes to PyPI
- Tag & Release: Creates git tags and GitHub releases
Version Management
- Versions follow IB's format:
10.40.01,10.37.02, etc. - Git tags:
v10.40.01,v10.37.02, etc. - PyPI packages:
- Latest:
ibapi-latest==10.40.01 - Stable:
ibapi-stable==10.37.02
- Latest:
๐ License
This project has a dual license structure:
IB API Source Code (ibapi/ directory)
The Interactive Brokers TWS API source code is proprietary software owned by Interactive Brokers LLC and is licensed under the TWS API Non-Commercial License.
Key restrictions:
- โ Use for personal trading and account management
- โ Develop internal proprietary tools for your own IB account
- โ NOT permitted: Selling software to third parties
- โ NOT permitted: Distributing software to generate indirect financial benefit (e.g., commissions)
- โ ๏ธ Requires: Active Interactive Brokers account
For commercial use, contact Interactive Brokers at: opensource@interactivebrokers.com
Full license text: See LICENSE file
Automation Scripts (scripts/ directory, workflows)
The automation tooling that packages and publishes the IB API is licensed under the MIT License.
See the LICENSE file for complete details.
๐ Links
- PyPI Packages:
- Official IB API: https://interactivebrokers.github.io/tws-api
- Documentation: https://ibkrcampus.com/ibkr-api-page/
- GitHub Repository: https://github.com/yourusername/ibapi
๐ Support
For issues with:
- The IB API itself: Contact Interactive Brokers
- This package/automation: Open an issue on GitHub
โ๏ธ Configuration
The package configuration is in pyproject.toml:
[project]
name = "ibapi"
dynamic = ["version"] # Version from ibapi.__version__
dependencies = ["protobuf==5.29.3"]
[tool.setuptools]
packages = ["ibapi", "ibapi.protobuf"]
package-dir = {"" = "ibapi"} # Maps ibapi/ibapi/* to ibapi/*
This ensures imports work as expected:
from ibapi.client import EClient # Not from ibapi.ibapi.client
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ibapi_latest-10.47.1.tar.gz.
File metadata
- Download URL: ibapi_latest-10.47.1.tar.gz
- Upload date:
- Size: 162.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02872248ae23130baaf3ffb1eb751e24b21580457966bb18882374530d4f0e86
|
|
| MD5 |
f2794ad66a3663d2a01304c05f46c84d
|
|
| BLAKE2b-256 |
3c079147764eede459a6cc54edb3067874cdc98912fff8821a2a8f477a39c55e
|
Provenance
The following attestation bundles were made for ibapi_latest-10.47.1.tar.gz:
Publisher:
update-ibapi-latest.yml on deepentropy/ibapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ibapi_latest-10.47.1.tar.gz -
Subject digest:
02872248ae23130baaf3ffb1eb751e24b21580457966bb18882374530d4f0e86 - Sigstore transparency entry: 1629253507
- Sigstore integration time:
-
Permalink:
deepentropy/ibapi@3eacd1f2ae73d4361ca6da9529e0d45db5f84756 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepentropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
update-ibapi-latest.yml@3eacd1f2ae73d4361ca6da9529e0d45db5f84756 -
Trigger Event:
schedule
-
Statement type:
File details
Details for the file ibapi_latest-10.47.1-py3-none-any.whl.
File metadata
- Download URL: ibapi_latest-10.47.1-py3-none-any.whl
- Upload date:
- Size: 327.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fed17b710558b5beea72aac19142e1142aeb217c6bce63d70d2be2350577214f
|
|
| MD5 |
1cdfe369cbab2144d2cb6f99fa701ae6
|
|
| BLAKE2b-256 |
e1c18cf157e367acc0e357ee77a6adae6a8ab0963240e232aafe57d1a78f6279
|
Provenance
The following attestation bundles were made for ibapi_latest-10.47.1-py3-none-any.whl:
Publisher:
update-ibapi-latest.yml on deepentropy/ibapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ibapi_latest-10.47.1-py3-none-any.whl -
Subject digest:
fed17b710558b5beea72aac19142e1142aeb217c6bce63d70d2be2350577214f - Sigstore transparency entry: 1629253531
- Sigstore integration time:
-
Permalink:
deepentropy/ibapi@3eacd1f2ae73d4361ca6da9529e0d45db5f84756 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepentropy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
update-ibapi-latest.yml@3eacd1f2ae73d4361ca6da9529e0d45db5f84756 -
Trigger Event:
schedule
-
Statement type: