Skip to main content

Interactive Brokers Python API

Project description

ibapi

Automated publisher for the Interactive Brokers TWS API Python client on PyPI.

PyPI Latest PyPI Stable Python 3.7+ License

๐Ÿ“ฆ 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 (from main branch)
  • ibapi-stable: Previous IB API versions (from stable branch)

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

  1. Weekly Check: GitHub Actions runs every Monday at 9:00 AM UTC
  2. Version Detection: Scrapes https://interactivebrokers.github.io/ for new versions
  3. Download & Extract: Downloads the TWS API zip and extracts the Python client
  4. Auto-Fix: Automatically fixes version strings and package configuration
  5. Build & Publish: Builds the package and publishes to PyPI
  6. 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

๐Ÿ“ 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

๐Ÿ› Support

For issues with:

โš™๏ธ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibapi_latest-10.45.1.tar.gz (164.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibapi_latest-10.45.1-py3-none-any.whl (331.9 kB view details)

Uploaded Python 3

File details

Details for the file ibapi_latest-10.45.1.tar.gz.

File metadata

  • Download URL: ibapi_latest-10.45.1.tar.gz
  • Upload date:
  • Size: 164.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ibapi_latest-10.45.1.tar.gz
Algorithm Hash digest
SHA256 a1b4b3876be889fa3300e54d3355b791f4a40f7f78d0d2784b2dfc9f6677b5a0
MD5 dcda672f498bbe5bfc4408f9b100c8fd
BLAKE2b-256 a1823043d4d4cdab4fac92db01380cc4f6d5ce2072fa1575db782dc66efddb27

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibapi_latest-10.45.1.tar.gz:

Publisher: update-ibapi-latest.yml on deepentropy/ibapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ibapi_latest-10.45.1-py3-none-any.whl.

File metadata

  • Download URL: ibapi_latest-10.45.1-py3-none-any.whl
  • Upload date:
  • Size: 331.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ibapi_latest-10.45.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08c8af3b74f0bf976a8d22d6f8c29aa3632d6d4e5c05896fa0ebfbd0d7143434
MD5 c098719269d30aa536e4b0ccc3ea5b43
BLAKE2b-256 6820e71d5f5462b84cda2d7d09d6ecf169a2b276e81b78c11df1c6b8cfcce6ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibapi_latest-10.45.1-py3-none-any.whl:

Publisher: update-ibapi-latest.yml on deepentropy/ibapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page