← 返回 Skills 市场
oscraters

IBKR CLI

作者 oscraters · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
645
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install ibkr
功能描述
Comprehensive Interactive Brokers (IBKR) TWS/Gateway skill using ib_insync. Includes Python and bash CLIs for account, market data, historical data, contract...
使用说明 (SKILL.md)

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 \x3Ccommand> [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 \x3Ccommand> [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.

安全使用建议
This skill appears to do exactly what it claims: a local CLI for Interactive Brokers via ib_insync. Before installing/use: 1) Review and run tests in a safe environment (paper account) — the CLI can place/cancel real orders. 2) Install ib_insync from PyPI (pip install ib_insync) rather than running unknown install scripts. 3) Keep IBKR_HOST default (127.0.0.1) unless you intentionally want to connect to a remote IB Gateway/TWS; do not point it to untrusted remote hosts. 4) Inspect the code yourself if you are concerned — there are no obfuscated network calls or hidden endpoints, but trade-capable scripts carry financial risk if misused.
功能分析
Type: OpenClaw Skill Name: ibkr Version: 1.0.0 The OpenClaw IBKR skill bundle provides a legitimate interface to Interactive Brokers TWS/Gateway via the `ib_insync` Python library. All scripts (`ibkr.sh`, `openclaw.sh`, `ibkr_cli.py`, and compatibility wrappers) correctly parse arguments using `argparse` and interact with the IBKR API for financial operations like account management, market data, and order placement. There is no evidence of prompt injection in `SKILL.md`, data exfiltration, unauthorized system access, persistence mechanisms, or obfuscation. The use of environment variables for configuration is standard, and all operations align with the stated purpose of a trading skill.
能力评估
Purpose & Capability
Name/description describe an IBKR CLI and the repository contains Python and bash CLIs, legacy wrappers, and tests that implement account queries, market data, historical data, contract lookup, scanners, and order placement — all consistent with the stated purpose.
Instruction Scope
SKILL.md and the scripts limit actions to connecting to TWS/IB Gateway and performing IB operations. One notable capability: the CLI can place and cancel real orders, so use with caution (test in paper mode). The instructions do not attempt to read unrelated files or exfiltrate data to third-party endpoints; connection parameters can be overridden to point at arbitrary hosts (by design) — ensure you don't point it to untrusted remote endpoints.
Install Mechanism
No install spec is provided (instruction-only for environment setup). The SKILL.md recommends installing the well-known ib_insync package from PyPI; there are no downloads from arbitrary URLs or extract/remote install steps in the manifest.
Credentials
No required secrets or config paths are declared. The code accepts optional IBKR_HOST/IBKR_PORT/IBKR_CLIENT_ID/IBKR_ACCOUNT environment variables (documented) which are appropriate for configuring an IB connection. No unrelated credentials or high-privilege environment access is requested.
Persistence & Privilege
Skill is not always-enabled and does not request persistent or elevated platform privileges. It does perform actions (including placing orders) when invoked, which is expected for a trading CLI.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ibkr
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ibkr 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
IBKR Skill v1.0.0 – Initial Release - Unified Python and bash CLIs for Interactive Brokers workflows, powered by ib_insync. - Supports account summary, positions, portfolio, PnL, quotes, historical data, contract lookup, order placement/cancellation, and market scanners. - Flexible connection configuration via CLI flags and environment variables. - Legacy scripts (`get_account_info.py`, `get_historical_data.py`, `place_order.py`) maintained for backward compatibility. - Robust error handling with non-zero exit codes for common operational failures.
元数据
Slug ibkr
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

IBKR CLI 是什么?

Comprehensive Interactive Brokers (IBKR) TWS/Gateway skill using ib_insync. Includes Python and bash CLIs for account, market data, historical data, contract... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 645 次。

如何安装 IBKR CLI?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ibkr」即可一键安装,无需额外配置。

IBKR CLI 是免费的吗?

是的,IBKR CLI 完全免费(开源免费),可自由下载、安装和使用。

IBKR CLI 支持哪些平台?

IBKR CLI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 IBKR CLI?

由 oscraters(@oscraters)开发并维护,当前版本 v1.0.0。

💬 留言讨论