Actively developed AlgoGP bridge

ib_async guide

After ib_insync’s author passed away in 2024, the community continued the project as ib_async.

Last reviewed · Also known as ib_insync, ib-insync, ibapi

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_async
Install
from 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())
Hourly futures bars from a paper Gateway.

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.py
  • frameworks/tests/test_bridge.py
  • frameworks/ib_async_broker.py
  • requirements.txt gains: ib_async
python frameworks/ib_async_broker.py
Run the AlgoGP strategy with ib_async.

ib_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

Independent guide. AlgoGP is not affiliated with ib_async. Features, licenses and maintenance change; check the official documentation. Nothing here is investment advice.

Build a strategy