The maintained Interactive Brokers Python client - successor to the archived ib_insync - where one digit of the port number is all that separates paper from live. TRIGGER - import ib_async, from ib_async import IB, pip install ib_async, ib.connect, clientId, ports 7496 7497 4001 4002, TWS, IB Gateway, reqHistoricalData, reqMktData, reqTickersAsync, placeOrder, managedAccounts, reqPositions, reqOpenOrders, reqExecutions, Master Client ID, Read-Only API, orderRef, ibflex, ibapi, ib_insync; "Enable ActiveX and Socket Clients", pacing violations, error 1102, a DU or U account prefix. Memory is stale here: ib_insync was archived 2024-03-14 after its author died, ib_async 2.1.0 (2025-12-08) is the successor and does not wrap ibapi, its main branch has been static about nine months, and ib_fut does not exist. SKIP for non-IB brokers and for the general order-safety patterns (broker-execution-apis). SKIP for choosing between libraries, or when no library is named - the domain skill's job.
Ships in fin-libraries. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The one broker whose default is safe — and the one where a single character switches paper for live.
| pip / import | pip install ib_async · import ib_async |
| Version | 2.1.0 (2025-12-08) · requires_python >=3.10 |
| Licence | BSD-2 |
| Status | ✅ The successor. 1,730★ ib-api-reloaded/ib_async. ⚠️ main static since 2025-12-06 |
🚨 Connecting to 7496 (TWS live) or 4001 (Gateway live) instead of 7497 / 4002 sends real orders. One character, and there is no other confirmation. The other four ways to send a live order by accident:
clientId that has resting orders from another process.ib.placeOrder() with orderType='MKT' outside RTH on an illiquid contract.Assert on the account ID, not the port. IB paper accounts are prefixed DU (or DF); live accounts start with U. The account ID is a server-returned fact; the port is a local config value you can typo.
Verbatim from IB's docs: "Read-Only API" is enabled by DEFAULT in TWS "as an additional precautionary measure". When active, API orders are prevented (and order info is not exposed to the API). IB is the one broker where the default is safe and you must deliberately opt into danger. Leave it on until the strategy is proven; treat turning it off as a deployment step with its own checklist.
| Client | Status |
|---|---|
ib_async 2.1.0 (2025-12-08) | ✅ the successor. BSD-2, 1,730★ |
🔴 ib_insync 0.9.86 (2023-07-02) | ARCHIVED 2024-03-14. The repo notice is from the author's family: Ewald de Wit died 2024-03-11. Do not start new work on it and do not fork it |
ibapi (official) | PyPI shows 9.81.1.post1 from 2020-12-06 — badly stale. Real 10.x ships from IB's own site under IB's non-commercial API licence |
ibflex 1.1 (2026-05-23) | Parses IB Flex XML activity/trade reports — the tool for reconciliation and tax |
🚨 ib_fut | Does not exist. No PyPI package, no plausible repo. If a doc names it, that is an error |
✅ ib_async does NOT wrap ibapi: "The ibapi package from IB is not needed. ib_async implements the full IBKR API binary protocol internally." Strength: one dependency, async-native. Risk: it must track IB's protocol changes itself — note the next-protobuf branch, since IB is migrating to protobuf messages.
⚠️ Maintenance caveat to disclose. main's last commit is 2025-12-06 (= release 2.1.0). Work continues on next (through 2026-07-14: implied-vol field fixes, logging scoping, snapshot Ticker fixes) but has not merged or shipped in ~9 months. Open issues describe real bugs: gateway connections dropping after a successful connect, combo/BAG market data going NaN after long uptime, KeyError in contractDetails on warning 1102, stale reqTickersAsync cache reads. It moved to the ib-api-reloaded org because the maintainers could not get access to the original repo, PyPI project or docs. Single maintainer, acknowledged. Pin your version and read next.
Functionally identical from the API's perspective. IB Gateway consumes ~40% fewer resources and has no trading GUI — the right choice for headless deployment.
Budget for this before designing a pipeline around IB; for research history a dedicated vendor is usually cheaper than fighting pacing limits.
reqPositions · reqOpenOrders · reqExecutions · Master Client ID (that client automatically receives updates on all open orders and commission reports across clients — essential for reconciliation) · ibflex for end-of-day Flex-report truth.
🚨 IB's orderId is per-clientId and per-session — reusing a clientId across processes is how duplicate and orphan orders happen. IB's orderRef is a free-text tag, not an idempotency key. Treat any unexplained position as halt-and-alert, never as something to auto-flatten.
from ib_async import IB
ib = IB()
ib.connect("127.0.0.1", 7497, clientId=17) # 7497 = TWS paper; 7496 = TWS LIVE
acct = ib.managedAccounts()[0]
assert acct.startswith("DU"), f"REFUSING TO TRADE: {acct} is not a paper account"
../../../fin-core/skills/broker-execution-apis/SKILL.md §3 — order-safety patterns to emit by default../../../fin-core/skills/broker-execution-apis/references/interactive-brokers.md — the source card../../../fin-core/skills/broker-execution-apis/references/_broker-matrix.md — client status across brokersThis file is the deep dive on one library and assumes the choice is already made.
For which library to pick, how it compares with the alternatives, and the traps that span
several of them, the entry point is the domain skill broker-execution-apis (../../../fin-core/skills/broker-execution-apis/SKILL.md).
What SKILL.md sets; muted values are Claude Code's defaults
/fin-libraries:lib-ib-asyncfrom fin-libraries
npx claudepluginhub howard-lynn-ye/fin-rsi --plugin fin-libraries24 skills in this plugin
/lib-akshareakshare is the widest free Chinese-market scraper (1,103 public interfaces) and it purges its own PyPI history, so you cannot pin it. TRIGGER - akshare, "import akshare as ak", pip install akshare, stock_zh_a_hist, stock_zh_a_daily, index_stock_cons_csindex, stock_zt_pool_em, stock_zh_a_stop_em, adjust="qfq"/"hfq", 复权, 前复权, 后复权, 涨跌停, 东方财富, 新浪财经, A股数据, 沪深300成分股, "No matching distribution found for akshare==", akshare 报错, akshare 封 IP. akshare ships roughly 2.3 releases a week and deletes the old ones, so any signature, column name or version pin you remember is probably already gone. SKIP for lib-tushare, which is the skill for point-in-time fundamentals and dated index membership. SKIP when the question is WHICH library to choose, or names no library at all - both belong to the domain skill./lib-alpaca-pyAlpaca's current Python SDK, which defaults to the paper host but lets url_override silently send live orders from a client that believes it is in the sandbox. TRIGGER - import alpaca, pip install alpaca-py, TradingClient, StockHistoricalDataClient, CryptoHistoricalDataClient, submit_order, LimitOrderRequest, MarketOrderRequest, OrderSide, TimeInForce, client_order_id, url_override, paper=True, BaseURL.TRADING_PAPER, paper-api.alpaca.markets, bracket OCO OTO orders, trail_percent, IEX vs SIP feed, Algo Trader Plus, alpaca-trade-api, APCA_API_BASE_URL; an order rejected asynchronously for time-in-force or price precision. Memory is stale here: alpaca-trade-api was deprecated in 2024 and defaulted to LIVE, whereas alpaca-py 0.44.0 (2026-08-11) declares paper=True - the widely repeated warning is inverted. SKIP for Interactive Brokers and for the general order-safety patterns (broker-execution-apis). SKIP for choosing between libraries, or when no library is named - the domain skill's job.Other plugins' skills for the same job