# Send IBKR CLI to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "ibkr",
    "name": "IBKR CLI",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/oscraters/ibkr",
    "canonicalUrl": "https://clawhub.ai/oscraters/ibkr",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/ibkr",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ibkr",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "references/api_reference.md",
      "scripts/get_account_info.py",
      "scripts/get_historical_data.py",
      "scripts/ibkr.sh"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "ibkr",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-04T06:29:25.418Z",
      "expiresAt": "2026-05-11T06:29:25.418Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ibkr",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ibkr",
        "contentDisposition": "attachment; filename=\"ibkr-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "ibkr"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/ibkr"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/ibkr",
    "downloadUrl": "https://openagent3.xyz/downloads/ibkr",
    "agentUrl": "https://openagent3.xyz/skills/ibkr/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ibkr/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ibkr/agent.md"
  }
}
```
## Documentation

### 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.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: oscraters
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-04T06:29:25.418Z
- Expires at: 2026-05-11T06:29:25.418Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/ibkr)
- [Send to Agent page](https://openagent3.xyz/skills/ibkr/agent)
- [JSON manifest](https://openagent3.xyz/skills/ibkr/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/ibkr/agent.md)
- [Download page](https://openagent3.xyz/downloads/ibkr)