Skip to main content

Interactive Brokers Python API

Project description

IB API Python - Automated Publisher

This project automatically downloads the Interactive Brokers TWS API Python client and publishes it to PyPI.

Overview

The Interactive Brokers TWS API is distributed as a zip file containing multiple language bindings. This project:

  1. Downloads the latest TWS API zip file from https://interactivebrokers.github.io/
  2. Extracts only the Python client (IBJts/source/pythonclient)
  3. Commits the extracted code to a git branch
  4. Tags the commit with the API version number
  5. (Future) Publishes to PyPI automatically

Quick Start

Method 1: Automatic (if web access is unrestricted)

# Get the download URL from the IB website
python get_download_url.py

# Update the IB API using the URL from above
python update_ibapi.py <download_url>

Method 2: Manual URL

If automatic scraping doesn't work (e.g., due to firewall/proxy restrictions):

  1. Open https://interactivebrokers.github.io/ in your browser
  2. Find the download link in the table (usually the third row: tr.linebottom:nth-child(3) > td:nth-child(2) > a)
  3. Right-click and copy the link address
  4. Run the update script:
python update_ibapi.py <download_url>

Example:

python update_ibapi.py https://interactivebrokers.github.io/downloads/twsapi_macunix.1040.01.zip

How It Works

Version Detection

The version is automatically extracted from the zip filename. For example:

  • twsapi_macunix.1040.01.zip → version 1040.01
  • twsapi_macunix.1051.00.zip → version 1051.00

Git Workflow

  1. The Python client code is copied to the ibapi/ directory
  2. Changes are committed with message: Update IB API to version X.XX
  3. A git tag is created: vX.XX

File Structure

ibapi-python/
├── README.md                 # This file
├── get_download_url.py      # Helper script to fetch download URL
├── update_ibapi.py          # Main automation script
├── scrape_and_publish.py    # Legacy script (alternative method)
└── ibapi/                   # IB Python client code (created after first run)
    ├── client.py
    ├── wrapper.py
    └── ...

Requirements

pip install requests beautifulsoup4

Manual Steps (Alternative)

If you prefer to do it manually:

  1. Download the TWS API zip from https://interactivebrokers.github.io/
  2. Extract the zip file
  3. Copy IBJts/source/pythonclient/* to ibapi/ in this repository
  4. Commit and tag:
git add ibapi/
git commit -m "Update IB API to version X.XX"
git tag -a vX.XX -m "Version X.XX"

Future Enhancements

  • Automatic publishing to PyPI
  • GitHub Actions workflow for scheduled checks
  • Version comparison to detect updates
  • Automated testing of the Python client
  • setup.py for PyPI packaging

License

The IB API code is proprietary to Interactive Brokers. This automation tool is provided as-is.

Support

For issues with:

  • The IB API itself: Contact Interactive Brokers
  • This automation tool: Open an issue in this repository

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_stable-10.37.2.tar.gz (90.4 kB view details)

Uploaded Source

Built Distribution

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

ibapi_stable-10.37.2-py3-none-any.whl (115.1 kB view details)

Uploaded Python 3

File details

Details for the file ibapi_stable-10.37.2.tar.gz.

File metadata

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

File hashes

Hashes for ibapi_stable-10.37.2.tar.gz
Algorithm Hash digest
SHA256 189b22896beadea81da0c88c4145897ef0fff8dc92a68970281b3227afec2672
MD5 f99cb1c52fe8823e903643b0fab9775a
BLAKE2b-256 97ca4ead4f48fd2985bba4653c75a544918d1ebd81512170406aaf600dde1dd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibapi_stable-10.37.2.tar.gz:

Publisher: update-ibapi-stable.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_stable-10.37.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for ibapi_stable-10.37.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6b616c9530979d440e1e6d24f47d9a287763626ded07e7fffb1890064b51989
MD5 62aea3e07c2addd771f4826f904cc757
BLAKE2b-256 965fdb648859e80d7f707a85a746b7333d3abefb82fbb9d7d72713110d33b989

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibapi_stable-10.37.2-py3-none-any.whl:

Publisher: update-ibapi-stable.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