Quick answer
ib_async is the community-maintained successor of ib_insync, the most popular Python client for Interactive Brokers. It wraps IBKR’s callback-based TWS API in a synchronous-looking, asyncio-based interface: IB().connect() to TWS or IB Gateway, qualify contracts, request historical bars and market data, and place orders, with live objects that update as events arrive.
ib_async at a glance
- Category
- Broker, exchange & data libraries
- Language
- Python
- License
- BSD-2-Clause
- Does
- Market data, Order execution
- Markets
- Stocks, ETFs, Options, Futures, Forex, Bonds, Crypto
- Best for
- Python access to everything Interactive Brokers offers: stocks, options, futures, FX, bonds and crypto.
- In AlgoGP
- Built-in bridge: add it to any project
Pick it if
Python access to everything Interactive Brokers offers: stocks, options, futures, FX, bonds and crypto.
Watch out for
Requires a running, logged-in TWS or IB Gateway.
ib_async strengths and limitations
Strengths
- Far simpler than the official ibapi.
- Works in scripts, notebooks and asyncio apps.
- Covers the full TWS API.
Limitations
- Requires a running, logged-in TWS or IB Gateway.
- IBKR’s pacing limits and daily restarts still apply.
ib_async example
pip install ib_asyncfrom ib_async import IB, Future, util
ib = IB()
ib.connect("127.0.0.1", 4002, clientId=1)
es = ib.qualifyContracts(Future("ES", "202612", "CME"))[0]
bars = ib.reqHistoricalData(es, "", "5 D", "1 hour", "TRADES", useRTH=False)
print(util.df(bars).tail())Use ib_async with AlgoGP
AlgoGP has a built-in ib_async bridge. Describe the strategy to the copilot and backtest it in AlgoGP, then open the project’s APIs & keys tab and add ib_async under Frameworks. The project gains these files, saved as a new version and included in every export:
frameworks/algogp_bridge.pyframeworks/tests/test_bridge.pyframeworks/ib_async_broker.pyrequirements.txtgains:ib_async
python frameworks/ib_async_broker.pyib_async connects to Interactive Brokers. Each guide shows how to create the API key, which you can store in the project’s Keys & secrets.
ib_async: frequently asked questions
Is ib_insync still maintained?
Development moved to ib_async; switch imports from ib_insync to ib_async.
Does AlgoGP support ib_async?
Yes. AlgoGP’s built-in IBKR adapter uses the Client Portal Gateway; add the ib_async framework to trade futures, FX and more through TWS.
ib_async alternatives
- QuantConnect LEANC#, PythonThe open-source engine behind QuantConnect: event-driven backtesting and live trading in C# or Python across equities, options, futures, FX and crypto.
- NautilusTraderPython, RustHigh-performance, Rust-core trading platform with a Python API: the same strategy runs in a nanosecond-resolution backtester and live across many venues.
- LumibotPythonBeginner-friendly Python framework from Lumiwealth: one Strategy class for backtesting and live trading stocks, options, futures and crypto.
- BacktraderPythonThe classic Python event-driven backtesting library: Cerebro, data feeds, analyzers, sizers and plotting, with live stores for IB and OANDA.
Independent guide. AlgoGP is not affiliated with ib_async. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.