Communitygithub.com

modbender/skill-library-mcp

全面的 Interactive Brokers (IBKR) TWS/Gateway 技能,基于 ib_insync 实现。包含用于账户、市场数据、历史数据、合约查询、扫描仪和订单生命周期管理的 Python 和 Bash CLI。

skill-library-mcp 是什么?

该技能通过 `ib_insync` 库与 Interactive Brokers Trader Workstation (TWS) 或 IB Gateway 集成,为开发者提供了一套统一且功能强大的命令行工具,用于操作 IBKR 的各种核心工作流。它同时提供了 Python CLI (`ibkr_cli.py`) 和 Bash CLI (`ibkr.sh`),支持账户信息查询、市场数据获取、历史数据检索、合约详情发现、市场扫描仪以及完整的订单生命周期管理(包括市价单、限价单、止损单等)。该技能通过环境变量或命令行参数灵活配置连接,并兼容现有的遗留脚本入口点,确保平滑迁移。对于需要以编程方式与 IBKR 进行高频交互、自动化交易策略或进行数据分析的量化开发者、算法交易员和金融工程师来说,该技能极大地简化了与 IBKR 的集成复杂度,提供了一个开箱即用的可靠接口。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/modbender/skill-library-mcp/tree/HEAD/data/ibkr

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

IBKR 技能

概览

本技能通过 ib_insync 与 Interactive Brokers Trader Workstation (TWS) 和 IB Gateway 集成,通过以下方式暴露可操作的 IBKR 工作流:

  • 统一的 Python CLI:scripts/ibkr_cli.py
  • Bash CLI 包装器:scripts/ibkr.sh
  • 兼容性别名:scripts/openclaw.sh
  • 向后兼容的脚本入口点:
    • scripts/get_account_info.py
    • scripts/get_historical_data.py
    • scripts/place_order.py

前提条件

  • 拥有 API 权限的 Interactive Brokers 账户。
  • 运行中的 TWS 或 IB Gateway,并已启用 API。
  • 建议使用 Python 3.9+。
  • 已安装 ib_insync:
pip install ib_insync

连接配置

所有 CLI 都支持通过标志或环境变量进行连接覆盖。

环境变量:

  • IBKR_HOST(默认 127.0.0.1)
  • IBKR_PORT(默认 7497)
  • IBKR_CLIENT_ID(默认 1)
  • IBKR_ACCOUNT(可选)

示例:

IBKR_PORT=4002 IBKR_CLIENT_ID=14 ./scripts/ibkr.sh account-summary
python3 scripts/ibkr_cli.py positions --host 127.0.0.1 --port 7496 --account DU123456

Bash CLI

./scripts/ibkr.sh <command> [args]

支持的命令:

  • account(账户摘要 + 持仓)
  • account-summary
  • positions
  • portfolio
  • pnl
  • quote
  • historical
  • place-order
  • cancel-order
  • open-orders
  • executions
  • contract-details
  • scanner

./scripts/openclaw.sh 是同一 CLI 表面的别名。

Python CLI

python3 scripts/ibkr_cli.py <command> [args]

账户服务

python3 scripts/ibkr_cli.py account-summary --json
python3 scripts/ibkr_cli.py positions --account DU123456
python3 scripts/ibkr_cli.py portfolio --json
python3 scripts/ibkr_cli.py pnl --account DU123456 --wait 2

市场数据服务

python3 scripts/ibkr_cli.py quote --symbol AAPL --sec-type STK --market-data-type 3
python3 scripts/ibkr_cli.py historical --symbol EURUSD --sec-type CASH --duration "30 D" --bar-size "1 hour"

注意:

  • 历史数据请求支持通过标志使用完整的 IB 格式值,包括像 "30 D" 这样包含空格的令牌。
  • 对于 CASH,除非显式覆盖,否则默认的 whatToShow 是 MIDPOINT。

合约发现

python3 scripts/ibkr_cli.py contract-details --symbol ES --sec-type FUT --expiry 202606

交易与订单生命周期

python3 scripts/ibkr_cli.py place-order --symbol AAPL --sec-type STK --action BUY --quantity 10 --order-type MKT
python3 scripts/ibkr_cli.py place-order --symbol AAPL --sec-type STK --action SELL --quantity 10 --order-type LMT --limit-price 250 --tif GTC
python3 scripts/ibkr_cli.py open-orders
python3 scripts/ibkr_cli.py cancel-order --order-id 12345
python3 scripts/ibkr_cli.py executions --json

CLI 中支持的订单类型:

  • MKT
  • LMT
  • STP
  • STP LMT

place-order 会等待状态更新并显示下单过程中收集的 API 错误。

扫描仪服务

python3 scripts/ibkr_cli.py scanner --instrument STK --location-code STK.US.MAJOR --scan-code TOP_PERC_GAIN --rows 25

兼容性脚本

遗留脚本仍然受支持,现已委托给统一的 CLI:

  • get_account_info.py
  • get_historical_data.py(遗留的位置参数模式仍然有效)
  • place_order.py(遗留的位置参数模式仍然有效)

错误处理

在以下情况下,CLI 会返回非零退出码:

  • 导入/依赖项失败
  • 连接失败
  • 合约资格认证失败
  • 无效参数
  • 尝试取消时找不到未成交订单

参考

参见 references/api_reference.md 以获取 IBKR 和 ib_insync 文档链接。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

modbender/skill-library-mcp

Complete investment portfolio risk management system. Analyze positions, calculate risk metrics, stress test scenarios, optimize allocations, and generate institutional-grade risk reports — all wit...

modbender/skill-library-mcp

Borrow from Aave via credit delegation. Agent self-funds by borrowing against delegator collateral. Supports borrow, repay, health checks. Works on Aave V2/V3.

modbender/skill-library-mcp

Discover and register autonomous AI agents. Use when: browsing the agent registry, submitting an agent for verification, or embedding agent badges. NOT for: general web search or agent capability analysis.

modbender/skill-library-mcp

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, explainer videos, virtual influencers, dubbing, marketing videos. Triggers: ai avatar, talking head, lipsync, avatar video, virtual presenter, ai spokesperson, audio driven video, heygen alternative, synthesia alternative, talking avatar, lip sync, video avatar, ai presenter, digital human

modbender/skill-library-mcp

AI代码编辑器规则模板集合 - 为Cursor、Windsurf、Claude Code、Cline等AI编辑器提供项目规则配置。适用于需要配置AI编码助手规则的开发者,包含全栈Web、移动端、Vue3+SpringBoot等技术栈模板。

modbender/skill-library-mcp

Generate landing page code from product descriptions

modbender/skill-library-mcp

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awareness. Triggers: marketing video, ad video, promo video, commercial, brand video, product video, explainer video, ad creative, video ad, facebook ad video, youtube ad, instagram ad, tiktok ad, promotional video, launch video

modbender/skill-library-mcp

Generate AI music videos end-to-end. Creates music with Suno (sunoapi.org), generates visuals with OpenAI/Seedream/Google/Seedance, and assembles into music video with ffmpeg. Supports timestamped lyrics (auto SRT), Suno native music video generation, slideshow/video/hybrid modes. Token-based cost tracking per generation.

modbender/skill-library-mcp

Generate AI-powered notes from videos (document, outline, or graphic-text formats)

modbender/skill-library-mcp

The video AI notes tool is provided by Baidu. Based on the video download address provided by the user, it downloads and parses the video, and finally generates AI notes corresponding to the video (a total of three types of notes can be generated: document notes, outline notes, and image-text notes).

modbender/skill-library-mcp

Automated appointment management for beauty salons, clinics, studios, and photo booths. Handles booking requests, calendar sync, conflict detection, reminders, no-show tracking, and waitlist management.

modbender/skill-library-mcp

Bird identification, life list tracking, and trading card generation. Use this skill when the user: sends a bird photo to identify, says "set up my Birdfolio" or "set my region", asks "how's my checklist", asks "Birdfolio progress", asks "how many birds have I found", asks "show my Birdfolio" or "show my life list", asks "what's my rarest bird", or asks "tell me about [bird species]". Handles everything from first-time setup through ongoing life list tracking and visual trading card generation.

modbender/skill-library-mcp

Multi-project task and research management (JSON-first CLI)

modbender/skill-library-mcp

Track stock and crypto portfolios with CLI - real-time prices, P&L, dividend tracking, multiple portfolios

modbender/skill-library-mcp

Track cryptocurrency portfolios with real-time prices, P&L calculations, and allocation analysis. Query Bitcoin, Ethereum, Solana and 10,000+ token holdings.

modbender/skill-library-mcp

加密貨幣Portfolio追蹤 - 支援TRON/ETH/BSC,分析持倉、收益、Gas費用

modbender/skill-library-mcp

Lead strategy with competitive analysis, strategic planning, growth roadmaps, and business portfolio management.

modbender/skill-library-mcp

Create ATS-optimized resumes and CVs with proper structure, metrics, and industry targeting.

modbender/skill-library-mcp

Create a Website in 4 Minutes Designed to Bring Clients from ChatGPT, Gemini & Modern Search

modbender/skill-library-mcp

Native video analysis using Google Gemini API. Upload and analyze video files — describe scenes, extract text/UI, answer questions about content, transcribe speech, identify objects and actions. Use when: (1) User sends a video file and wants it analyzed, (2) Video summarization or description needed, (3) Extracting text, UI elements, or information from screen recordings, (4) Answering questions about video content, (5) Comparing multiple videos, (6) Analyzing tutorials, demos, or walkthroughs.

相关技能