Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

ibkr-api-skillibkr API 技能

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

840

周安装

35

GitHub Stars

12

下载量

280
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ibkr-api-skill(ibkr API 技能)
来源仓库:https://github.com/scientiacapital/skills
仓库路径:skills/ibkr-api-skill
安装命令:
npx skills add https://github.com/scientiacapital/skills --skill ibkr-api-skill
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/scientiacapital/skills --skill ibkr-api-skill

简介

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。

  • 适合梳理 endpoint、适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 生成 OpenAPI 草稿或检查字段命名。
  • 使用时需确认真实业务语义、鉴权方式和错误处理规则, 避免凭空补字段。ibkr-api-skill 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

<quick_start>

  1. Install: pip install ib_async
  2. Start IB Gateway on port 7497 (paper) or 7496 (live)
  3. Connect: ib = IB(); await ib.connectAsync('127.0.0.1', 7497, clientId=1)
  4. Query: positions = ib.positions() / summary = await ib.accountSummaryAsync() </quick_start>

<success_criteria>

  • API connection established and authenticated
  • Portfolio positions and balances retrieved across all linked accounts
  • IRA restrictions enforced on write operations
  • Credentials stored securely (never hardcoded) </success_criteria>

Quick Decision: Which API?

CriterionTWS API (Recommended)Client Portal REST API
Best forAutomated trading, portfolio mgmtWeb dashboards, light usage
AuthLocal login via TWS/IB GatewayOAuth 2.0 JWT
PerformanceAsync, low latency, high throughputREST, slower
Data qualityTick-by-tick availableLevel 1 only
Multi-accountAll accounts simultaneouslyPer-request
InfrastructureLocal Java app (port 7496/7497)HTTPS REST calls
Python libraryib_async (recommended)requests + OAuth
CostFreeFree

Default recommendation: TWS API via ib_async library for all programmatic work.

Account Architecture

Tim's setup: Roth IRA + Personal Brokerage + THK Enterprises (future business account)

  • All linked under single IBKR username/password
  • Single API session accesses all linked accounts
  • Use reqLinkedAccounts() to enumerate account IDs
  • Specify account ID per order placement
  • Market data subscriptions charged once across all linked accounts
  • One active session per username — connecting elsewhere closes current session

IRA-Specific Restrictions (Critical)

RestrictionImpact
No short sellingplaceOrder() will reject short orders
No margin borrowingCash-only (no debit balances)
No foreign currency borrowingMust execute FX trade first
Futures margin 2x higherPosition sizing affected
MLPs/UBTI prohibitedFilter these from IRA order flow
Withdrawals USD onlyInformational

Core API Operations

Read Operations (Safe — use for all account types)

# Key TWS API functions for portfolio queries
reqLinkedAccounts()        # List all account IDs
reqAccountSummary()        # Balances, buying power, equity (all accounts)
reqPositions()             # Current positions (up to 50 sub-accounts)
reqPositionsMulti()        # Per-account positions (>50 sub-accounts)
reqAccountUpdates()        # Stream account + position data (single account)
reqMktData()               # Real-time Level 1 market data
reqHistoricalData()        # Historical price data

Write Operations (Use with caution — respect IRA restrictions)

placeOrder(account_id, contract, order)  # Place order on specific account
cancelOrder(order_id)                     # Cancel pending order
reqGlobalCancel()                         # Cancel all open orders

Client Portal REST Endpoints (Alternative)

GET  /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 candles

Python Library: ib_async

Install: pip install ib_async

Why ib_async over alternatives:

  • Modern successor to ib_insync (original creator's project continued)
  • Native asyncio support
  • Implements IBKR binary protocol internally (no need for official ibapi)
  • Active maintenance (GitHub: ib-api-reloaded/ib_async)

Alternatives (use only if ib_async doesn't meet needs):

  • ib_insync — Legacy, stable but unmaintained since early 2024
  • ibapi — Official IBKR library, cumbersome event loop

Reference: Connection Pattern

See reference/connection-patterns.md for:

  • IB Gateway setup and configuration
  • Connection/reconnection handling
  • Session timeout management (6-min ping for CP API)
  • Multi-account query patterns
  • Error handling and rate limit management

Reference: Trading Patterns

See reference/trading-patterns.md for:

  • Order types (market, limit, stop, bracket, IB algos)
  • IRA-safe order validation
  • Multi-account order routing
  • Position sizing with account-type awareness
  • Greeks-aware options order flow

Infrastructure Requirements

  1. IB Gateway (lightweight) or TWS (full UI) running locally
  2. Java 8+ installed
  3. API enabled in TWS/Gateway settings
  4. Ports: 7496 (live) / 7497 (paper trading)
  5. Credentials: Stored in OS credential manager (never hardcode)

Security Best Practices

  • Run IB Gateway on localhost only (no internet exposure)
  • Use read-only login for portfolio queries when trading not needed
  • Store credentials in macOS Keychain / Linux secret-service
  • Implement session timeout handling
  • Validate market data subscriptions before placing orders
  • Log all order attempts with account ID + timestamp

Cost Structure

ItemCost
API accessFree
Market data$5-50/month per exchange subscription
Trading commissionsStandard IBKR rates (varies by asset)
Account minimums$500 per account
Estimated total~$1,500 aggregate minimum; $15-50/month data

Integration with Trading-Signals Skill

This skill complements the trading-signals-skill:

  • trading-signals → generates signals, confluence scores, regime detection
  • ibkr-api → executes trades, queries positions, manages accounts
  • Pipeline: Signal generation → Position sizing → IRA validation → Order execution

IBKR MCP Server (Installed)

ArjunDivecha/ibkr-mcp-server is installed and configured:

  • Location: ~/Desktop/tk_projects/ibkr-mcp-server/
  • Claude Code: Added to ~/.claude.json (user scope)
  • Claude Desktop: Added to claude_desktop_config.json
  • Mode: Paper trading (port 7497), live trading disabled
  • Safety: Order cap 1,000 shares, confirmation required

Available MCP Tools

ToolPurposeAccount Types
get_portfolioPositions + P&LAll accounts
get_account_summaryBalances, margin, buying powerAll accounts
switch_accountToggle Roth IRA / Personal / THKMulti-account
get_market_dataReal-time quotesN/A
get_historical_dataHistorical OHLCVN/A
place_orderOrders with safety checksAll (IRA restrictions enforced)
check_shortable_sharesShort availabilityPersonal/Business only
get_margin_requirementsMargin needs per securityPersonal/Business only
get_borrow_ratesBorrow costs for shortsPersonal/Business only
short_selling_analysisFull short analysis packagePersonal/Business only
get_connection_statusIB Gateway health checkN/A

To Activate

  1. Start IB Gateway → port 7497 (paper) or 7496 (live)
  2. Enable API: Config → API → Settings → "ActiveX and Socket Clients"
  3. Add 127.0.0.1 to Trusted IPs
  4. Restart Claude Code / Claude Desktop

Other Community MCP Servers

  • code-rabi/interactive-brokers-mcp — Client Portal REST API
  • xiao81/IBKR-MCP-Server — TWS API focused
  • Hellek1/ib-mcp — Read-only via ib_async (safest)

Multi-Broker Aggregation

For unified view across IBKR + Robinhood:

  • SnapTrade MCP (dangelov/mcp-snaptrade) — Read-only aggregator, 15+ brokerages, OAuth-based (safe)
  • Alpaca MCP (official) — Alternative broker with production-ready MCP
  • Manual CSV import from Robinhood as fallback (ToS-safe)

See reference/multi-broker-strategy.md for aggregation patterns.

Emit Outcome Sidecar

As the final step, write to ~/.claude/skill-analytics/last-outcome-ibkr-api.json:

{"ts":"[UTC ISO8601]","skill":"ibkr-api","version":"1.0.0","variant":"default",
 "status":"[success|partial|error]","runtime_ms":[estimated ms from start],
 "metrics":{"queries_executed":[n],"positions_analyzed":[n],"accounts_checked":[n]},
 "error":null,"session_id":"[YYYY-MM-DD]"}

Use status "partial" if some stages failed but results were produced. Use "error" only if no output was generated.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.56%
按下载量换算102

Claude

28.99%
按下载量换算81

Cursor

21.33%
按下载量换算60

Gemini CLI

9.73%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills