ibkr

Comprehensive Interactive Brokers (IBKR) TWS/Gateway skill using ib_insync. Includes Python and bash CLIs for account, market data, historical data, contract lookup, scanners, and order lifecycle management.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "ibkr" with this command: npx skills add oscraters/ibkr

IBKR Skill

Overview

This skill integrates with Interactive Brokers Trader Workstation (TWS) and IB Gateway through ib_insync, exposing operational IBKR workflows through:

  • A unified Python CLI: scripts/ibkr_cli.py
  • A bash CLI wrapper: scripts/ibkr.sh
  • Compatibility alias: scripts/openclaw.sh
  • Backward-compatible script entrypoints:
    • scripts/get_account_info.py
    • scripts/get_historical_data.py
    • scripts/place_order.py

Prerequisites

  • Interactive Brokers account with API permissions.
  • TWS or IB Gateway running with API enabled.
  • Python 3.9+ recommended.
  • ib_insync installed:
pip install ib_insync

Connection Configuration

All CLIs support connection overrides using flags or env vars.

Environment variables:

  • IBKR_HOST (default 127.0.0.1)
  • IBKR_PORT (default 7497)
  • IBKR_CLIENT_ID (default 1)
  • IBKR_ACCOUNT (optional)

Examples:

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]

Supported commands:

  • account (account summary + positions)
  • account-summary
  • positions
  • portfolio
  • pnl
  • quote
  • historical
  • place-order
  • cancel-order
  • open-orders
  • executions
  • contract-details
  • scanner

./scripts/openclaw.sh is an alias to the same CLI surface.

Python CLI

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

Account Services

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

Market Data Services

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"

Notes:

  • Historical requests support full IB-format values via flags, including spaced tokens like "30 D".
  • For CASH, default whatToShow is MIDPOINT unless explicitly overridden.

Contract Discovery

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

Trading and Order Lifecycle

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

Supported order types in the CLI:

  • MKT
  • LMT
  • STP
  • STP LMT

place-order waits for status updates and surfaces API errors collected during placement.

Scanner Service

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

Compatibility Scripts

Legacy scripts remain supported and now delegate to the unified CLI:

  • get_account_info.py
  • get_historical_data.py (legacy positional mode still works)
  • place_order.py (legacy positional mode still works)

Error Handling

The CLI returns non-zero exit codes for:

  • Import/dependency failures
  • Connection failures
  • Contract qualification failures
  • Invalid arguments
  • Missing open order for cancellation

References

See references/api_reference.md for IBKR and ib_insync documentation links.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Miaoji Asin Clinic Pro

亚马逊ASIN诊所Pro版,90天行动计划+竞品对标+季节性优化日历。 从合规度、广告度、评论度、视觉度、内容度五维升级为可执行的长期作战方案。 基础功能可使用 miaoji-asin-clinic 免费版。

Registry SourceRecently Updated
Coding

wechat-publish-pro

Pure Python tool to convert Markdown to styled HTML and publish articles to WeChat official account drafts with AI-based content refinement and theme support.

Registry SourceRecently Updated
Coding

Miaoji Asin Clinic

基于ASIN和品类,快速诊断亚马逊Listing五维健康指数并智能排序修复优先级,提供详细分析与个性化修复方案。

Registry SourceRecently Updated
Coding

Toonany

A Claude Code skill for creating AI-generated short dramas (漫剧) from novels and stories. Use when user mentions "漫剧创作", "小说转剧本", "分镜生成", "短剧制作", "故事线生成", "大纲...

Registry SourceRecently Updated