Loading...
Loading...
Compare original and translation side by side
pip install ib_asyncib = IB(); await ib.connectAsync('127.0.0.1', 7497, clientId=1)positions = ib.positions()summary = await ib.accountSummaryAsync()pip install ib_asyncib = IB(); await ib.connectAsync('127.0.0.1', 7497, clientId=1)positions = ib.positions()summary = await ib.accountSummaryAsync()| Criterion | TWS API (Recommended) | Client Portal REST API |
|---|---|---|
| Best for | Automated trading, portfolio mgmt | Web dashboards, light usage |
| Auth | Local login via TWS/IB Gateway | OAuth 2.0 JWT |
| Performance | Async, low latency, high throughput | REST, slower |
| Data quality | Tick-by-tick available | Level 1 only |
| Multi-account | All accounts simultaneously | Per-request |
| Infrastructure | Local Java app (port 7496/7497) | HTTPS REST calls |
| Python library | ib_async (recommended) | requests + OAuth |
| Cost | Free | Free |
| 评判标准 | TWS API(推荐) | Client Portal REST API |
|---|---|---|
| 最适用场景 | 自动化交易、投资组合管理 | Web仪表板、轻量使用场景 |
| 认证方式 | 通过TWS/IB Gateway本地登录 | OAuth 2.0 JWT |
| 性能 | 异步、低延迟、高吞吐量 | REST、速度较慢 |
| 数据质量 | 支持逐笔数据 | 仅Level 1数据 |
| 多账户支持 | 同时访问所有账户 | 每次请求指定单个账户 |
| 基础设施 | 本地Java应用(端口7496/7497) | HTTPS REST调用 |
| Python库 | ib_async(推荐) | requests + OAuth |
| 成本 | 免费 | 免费 |
reqLinkedAccounts()reqLinkedAccounts()| Restriction | Impact |
|---|---|
| No short selling | |
| No margin borrowing | Cash-only (no debit balances) |
| No foreign currency borrowing | Must execute FX trade first |
| Futures margin 2x higher | Position sizing affected |
| MLPs/UBTI prohibited | Filter these from IRA order flow |
| Withdrawals USD only | Informational |
| 限制内容 | 影响 |
|---|---|
| 禁止卖空 | |
| 禁止保证金借款 | 仅现金账户(无借方余额) |
| 禁止外币借款 | 必须先执行外汇交易 |
| 期货保证金要求翻倍 | 影响仓位规模 |
| 禁止MLP/UBTI | 需从IRA订单流中过滤这些资产 |
| 仅允许美元提款 | 信息提示 |
undefinedundefinedundefinedundefinedplaceOrder(account_id, contract, order) # Place order on specific account
cancelOrder(order_id) # Cancel pending order
reqGlobalCancel() # Cancel all open ordersplaceOrder(account_id, contract, order) # Place order on specific account
cancelOrder(order_id) # Cancel pending order
reqGlobalCancel() # Cancel all open ordersGET /iserver/accounts # List accounts
GET /iserver/account/{id}/positions # Positions
GET /iserver/account/{id}/summary # Balances
POST /iserver/account/{id}/orders # Place order
GET /market/candle # Historical candlesGET /iserver/accounts # List accounts
GET /iserver/account/{id}/positions # Positions
GET /iserver/account/{id}/summary # Balances
POST /iserver/account/{id}/orders # Place order
GET /market/candle # Historical candlespip install ib_asyncib_insyncibapipip install ib_asyncib_insyncibapireference/connection-patterns.mdreference/connection-patterns.mdreference/trading-patterns.mdreference/trading-patterns.md| Item | Cost |
|---|---|
| API access | Free |
| Market data | $5-50/month per exchange subscription |
| Trading commissions | Standard IBKR rates (varies by asset) |
| Account minimums | $500 per account |
| Estimated total | ~$1,500 aggregate minimum; $15-50/month data |
| 项目 | 成本 |
|---|---|
| API访问 | 免费 |
| 市场数据 | 每个交易所订阅每月5-50美元 |
| 交易佣金 | 标准IBKR费率(因资产类型而异) |
| 账户最低存款 | 每个账户500美元 |
| 预估总成本 | 合计最低约1500美元;每月数据费用15-50美元 |
trading-signals-skilltrading-signals-skill~/Desktop/tk_projects/ibkr-mcp-server/~/.claude.jsonclaude_desktop_config.json~/Desktop/tk_projects/ibkr-mcp-server/~/.claude.jsonclaude_desktop_config.json| Tool | Purpose | Account Types |
|---|---|---|
| Positions + P&L | All accounts |
| Balances, margin, buying power | All accounts |
| Toggle Roth IRA / Personal / THK | Multi-account |
| Real-time quotes | N/A |
| Historical OHLCV | N/A |
| Orders with safety checks | All (IRA restrictions enforced) |
| Short availability | Personal/Business only |
| Margin needs per security | Personal/Business only |
| Borrow costs for shorts | Personal/Business only |
| Full short analysis package | Personal/Business only |
| IB Gateway health check | N/A |
| 工具 | 用途 | 适用账户类型 |
|---|---|---|
| 持仓 + 盈亏 | 所有账户 |
| 余额、保证金、购买力 | 所有账户 |
| 切换罗斯IRA / 个人 / THK账户 | 多账户 |
| 实时报价 | N/A |
| 历史OHLCV数据 | N/A |
| 带安全检查的下单 | 所有账户(强制执行IRA限制) |
| 可卖空股票数量 | 仅个人/企业账户 |
| 每只证券的保证金需求 | 仅个人/企业账户 |
| 卖空借款成本 | 仅个人/企业账户 |
| 完整卖空分析包 | 仅个人/企业账户 |
| IB Gateway健康检查 | N/A |
code-rabi/interactive-brokers-mcpxiao81/IBKR-MCP-ServerHellek1/ib-mcpcode-rabi/interactive-brokers-mcpxiao81/IBKR-MCP-ServerHellek1/ib-mcpdangelov/mcp-snaptradereference/multi-broker-strategy.mddangelov/mcp-snaptradereference/multi-broker-strategy.md