QuantRocket icon + IBKR icon

Leverage Advanced Capabilities of the Interactive Brokers API

QuantRocket's full-featured integration of the IBKR API supports advanced capabilities that platforms with more generic broker integrations rarely offer. Interactive Brokers was QuantRocket's first broker integration and remains its tightest.

Multiple account structures: Connect individual, advisor, or institutional accounts. Connect multiple accounts even if they're not linked. Learn more

Historical data integration: Access IBKR's vast supply of global market data. Collect historical end-of-day and intraday data for global equities, futures, currencies, and indexes. Learn more

Real-time data integration: Access streaming or snapshot real-time data for quotes, trades, option greeks, and auction imbalances. Learn more

Short sale data: Accurately model short-selling constraints with current and historical cost-to-borrow and shortable shares data from IBKR. Learn more

Advanced order types: Use algorithmic orders, parent-child orders, bracket orders, and other advanced orders in your strategies. Learn more

Margin impact: Programmatically check an order's margin impact before placing it using "what-if" orders. Access current and historical special margin requirements for small-cap stocks. Learn more

Combos and spreads: Trade native or SMART-routed futures combos or stock and option spreads. Learn more

Skyscrapers

feature icon An Easy-to-Use Wrapper around the IBKR API

The IBKR API provides powerful access to global data and markets, but its asynchronous programming model can be difficult to master. QuantRocket's API provides a high-level wrapper around the IBKR API. QuantRocket automatically handles rate limits, reconnects, error responses, pacing violations, and other low-level complexities of working directly with the IBKR API.

How to collect real-time ticks from Interactive Brokers and automatically aggregate them to 1-minute bars, in 3 steps:

Step 1: Define the tick database.

from quantrocket.realtime import create_ibkr_tick_db

create_ibkr_tick_db(
    "tech-stk-tick",
    universes="tech-stk",
    fields=["LastPrice",
            "BidPrice",
            "AskPrice"]
)
{'status': 'successfully created tick database tech-stk-tick'}

Step 2: Define the aggregate database.

from quantrocket.realtime import create_agg_db

create_agg_db(
    "tech-stk-tick-1min",
    tick_db_code="tech-stk-tick",
    bar_size="1m"
)
{'status': 'successfully created aggregate database tech-stk-tick-1min from tick database tech-stk-tick'}

Step 3: Start collecting data!

from quantrocket.realtime import collect_market_data
collect_market_data("tech-stk-tick")
{'status': 'the market data will be collected until canceled'}
Install now
Questions?