ib-insync
Python sync/async framework for Interactive Brokers API
What it is and what it does
ib-insync is a Python framework that wraps Interactive Brokers' Trader Workstation (TWS) API to simplify programmatic trading and market data retrieval. It provides both synchronous and asynchronous interfaces built on asyncio and eventkit, allowing developers to write linear-style code or build advanced async applications. The library automatically keeps an IB component in sync with a running TWS or IB Gateway application, handling connection state and data updates transparently.
The package is designed for traders and developers who need to fetch historical data, place orders, or monitor live market data from Interactive Brokers without directly managing the low-level protocol. It supports Jupyter notebooks for interactive exploration and includes utilities for converting market data to pandas DataFrames. However, the repository is now archived with no active maintenance, meaning new API changes or Python compatibility issues will not be addressed.
Use it for:
- Download historical OHLC data for backtesting or analysis from Interactive Brokers.
- Build async trading bots that monitor live prices and execute orders programmatically.
- Explore market data interactively in Jupyter notebooks with automatic data synchronization.
- Retrieve account information, positions, and order status from a running TWS or IB Gateway.
- Develop multi-asset trading strategies that react to real-time market events.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python async/sync interface to Interactive Brokers' Trader Workstation API, automating connection management and data synchronization with live market data.
Yes, if you actively trade with Interactive Brokers and need a Python interface to TWS—the library is mature and widely used. However, proceed with caution: the repository is archived and unmaintained since March 2024. Install only if your TWS version and Python environment are stable, and be prepared to fork or patch the code if you encounter compatibility issues.
Install
ib-insync on PyPI
pip
pip install ib-insyncuv
uv add ib-insyncpoetry
poetry add ib-insyncInstalling ib-insync
Before you install
Low install friction with a pure-Python wheel. Repository is archived and last release was over a year ago; maintenance is inactive, so bug fixes and compatibility updates are unlikely.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install ib-insync
from ib_insync import IB, Forex
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)
contract = Forex('EURUSD')
bars = ib.reqHistoricalData(contract, endDateTime='', durationStr='30 D', barSizeSetting='1 hour', whatToShow='MIDPOINT', useRTH=True)
Requires a running TWS or IB Gateway application (version 1023 or higher) with API port enabled and 'Download open orders on connection' checked.
Verify before relying
- Whether the package remains compatible with current TWS/IB Gateway versions post-abandonment.
- Whether all runtime dependencies (eventkit, nest-asyncio, backports.zoneinfo) are actively maintained.
- Whether the package works reliably with Python 3.10 and 3.11 given the lack of recent updates.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — eventkit, nest-asyncio, dataclasses, backports.zoneinfo |
| Maintenance | abandoned — 1,139 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 784,858/month — #5,070 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ib_insync-0.9.86-py3-none-any.whl
Keywords: ibapi, tws, asyncio, jupyter, interactive, brokers, async
Tags
More Investment packages
Generates country- and subdivision-specific…
permissive · top 1,000 on PyPI
yfinanceFetches financial and market data from Yahoo…
permissive · top 1,000 on PyPI
numpy-financialProvides elementary financial functions (IRR,…
permissive · top 5,000 on PyPI
ccxtCCXT is a unified API library for connecting to…
permissive · top 5,000 on PyPI
databentoOfficial Python client for accessing live and…
permissive · top 5,000 on PyPI
edgartoolsEdgarTools parses SEC EDGAR filings into typed…
permissive · top 5,000 on PyPI
ib_asyncib_async provides a Python interface to…
permissive · top 15,000 on PyPI
metatrader5Connects Python to MetaTrader 5 Terminal to…
permissive · top 15,000 on PyPI
kiteconnectOfficial Python client for the Kite Connect…
permissive · top 15,000 on PyPI
growwapiSDK for connecting to Groww's trading platform…
permissive · top 15,000 on PyPI
aeventkitaeventkit provides event-driven data pipelines…
permissive · top 15,000 on PyPI
python-binanceUnofficial Python wrapper for the Binance…
permissive · top 15,000 on PyPI
eventkiteventkit provides an event-driven framework for…
permissive · top 5,000 on PyPI
finvizfinanceScrapes financial data from FinViz website,…
permissive · top 15,000 on PyPI
shioajiShioaji is a trading API for Taiwan's financial…
unclear · top 15,000 on PyPI