Xpersona
I

ibkr-cli

CLAWHUB · Unverified

Guide users through Interactive Brokers CLI operations — from installing IB Gateway/TWS and ibkr-cli itself, to trading stocks, monitoring accounts, retrievi... Skill: ibkr-cli Owner: fatwang2 Summary: Guide users through Interactive Brokers CLI operations — from installing IB Gateway/TWS and ibkr-cli itself, to trading stocks, monitoring accounts, retrievi... Tags: latest:1.0.1 Version history: v1.0.1 | 2026-03-25T11:56:21.689Z | user ibkr-cli 1.0.1 - Added detailed documentation in four new reference files: setup, trading, market data, and account management. - Expanded sk

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s175t0g13g19w85xczhk7fmvqs83gat0:ibkr-cli
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-fatwang2-ibkr-cli/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

36,368 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: ibkr-cli
description: Guide users through Interactive Brokers CLI operations — from installing IB Gateway/TWS and ibkr-cli itself, to trading stocks, monitoring accounts, retrieving market data, reading financial news, exploring options chains, screening stocks with market scanners, and querying company fundamentals. Use this skill whenever the user mentions Interactive Brokers, IBKR, TWS, IB Gateway, stock trading via CLI, checking portfolios or positions, getting quotes, placing orders, reading stock news, options chain, greeks, stock screener, market scanner, top gainers, most active, company fundamentals, financial statements, balance sheet, income statement, cash flow, ownership, institutional holders, or anything related to brokerage account management through a terminal. Even if the user doesn't say "ibkr" explicitly, trigger when they want to buy/sell stocks from the command line, check their brokerage account, read news about a stock, look up options data, screen for stocks, check company financials, or set up an API connection to a broker.
---

# ibkr-cli

You are helping a user who may have zero prior experience with Interactive Brokers, command-line tools, or trading APIs. Your job is to guide them step by step — from setting up the infrastructure to executing trades — using the `ibkr-cli` tool.

## How to approach the user

Start by understanding where the user is in their journey. Ask or infer:

1. Do they have IB Gateway or TWS installed and running?
2. Is `ibkr-cli` installed?
3. Have they verified connectivity (`ibkr doctor`)?

Don't dump all commands at once. Walk them through the relevant next step based on their current state. If they say "I want to buy AAPL", first check whether they have the infrastructure in place — don't jump straight to `ibkr buy`.

## Routing — read the right reference

Based on what the user needs, read the corresponding reference file for detailed commands and guidance:

| User intent | Reference file |
|---|---|
| Installing Gateway/TWS, installing ibkr-cli, configuring profiles, verifying connectivity, troubleshooting connection issues | `references/setup.md` |
| Buying/selling stocks, previewing orders, limit orders, cancelling orders, order management | `references/trading.md` |
| Quotes, historical bars, news headlines/articles, options chains, options greeks, market scanner/screener, company fundamentals, financial statements, ownership | `references/market-data.md` |
| Account summary, positions, portfolio, JSON output, updating the CLI | `references/account.md` |

When a user's request spans multiple areas (e.g., "set up ibkr and buy some AAPL"), read the relevant references in sequence — start with setup, then move to trading once the infrastructure is confirmed.

## Key principles

These apply across all commands — keep them in mind regardless of which reference you're reading:

- **Connection priority**: Unless the user explicitly mentions "paper" or a paper account, prefer live pr

_meta.json

{
  "ownerId": "kn7b98g7rdy4nckbx100z0p70s82vwek",
  "slug": "ibkr-cli",
  "version": "1.0.1",
  "publishedAt": 1774439781689
}

references/account.md

# Account Monitoring and Utilities

## Account summary

```bash
ibkr account summary --profile gateway-paper
```

Returns key metrics like NetLiquidation, TotalCashValue, BuyingPower. If the user asks "how much money do I have" or "what's my account worth", this is the command.

## Positions

```bash
ibkr positions --profile gateway-paper
```

Shows current holdings. If the user asks "what do I own" or "show my portfolio", use this.

## JSON output

All read commands and trading commands support `--json` for machine-readable output. Suggest this when the user wants to pipe output to another tool or process it programmatically:

```bash
ibkr quote AAPL --profile gateway-paper --json
ibkr account summary --profile gateway-paper --json
ibkr buy AAPL 10 --preview --profile gateway-paper --json
```

Error responses in JSON mode follow a structured format with `ok`, `error.code`, `error.message`, and `error.exit_code` fields.

## Updating

The CLI checks for new versions automatically once a day and prints a hint if an update is available. To upgrade:

```bash
ibkr update
```

This detects whether the user installed via pipx or pip and runs the appropriate upgrade command. If the user reports issues that may be version-related, suggest running `ibkr update` first.

references/market-data.md

# Market Data, News, Options, Scanner, and Fundamentals

## Quotes

### Snapshot quote

```bash
ibkr quote AAPL --profile gateway-paper
```

Returns a single point-in-time quote. The CLI automatically falls back from live to delayed data if the user's account doesn't have live market data subscriptions — no action needed from the user.

### Watch mode

```bash
ibkr quote AAPL --watch --updates 5 --interval 2 --profile gateway-paper
```

Prints 5 consecutive quote updates, 2 seconds apart. Useful when the user wants to monitor price movement in real time.

## Historical bars

```bash
ibkr bars AAPL --profile gateway-paper
ibkr bars AAPL --duration "1 D" --bar-size "5 mins" --profile gateway-paper
```

| Flag             | Default   | Description                              |
|------------------|-----------|------------------------------------------|
| `--duration`     | `1 D`     | Lookback period: `1 D`, `1 W`, `1 M`    |
| `--bar-size`     | `5 mins`  | Granularity: `1 min`, `1 hour`, `1 day`  |
| `--end`          | now       | End datetime: `"20260317 16:00:00"`      |
| `--what-to-show` | `TRADES`  | Data type: `TRADES`, `MIDPOINT`          |
| `--rth`          | default   | Regular trading hours only               |
| `--all-hours`    | —         | Include extended hours                   |

## News

ibkr-cli can retrieve news headlines and full articles for any symbol from IBKR's news providers.

### List news providers

```bash
ibkr news providers --profile gateway-paper
```

Shows available news sources (e.g., BRFG for Briefing.com, DJNL for Dow Jones). The user needs to know provider codes if they want to filter headlines by source.

### Headlines

```bash
ibkr news headlines AAPL --profile gateway-paper
ibkr news headlines AAPL --limit 20 --profile gateway-paper
ibkr news headlines AAPL --providers "BRFG,DJNL" --profile gateway-paper
ibkr news headlines AAPL --start "20260101 00:00:00" --end "20260318 00:00:00" --profile gateway-paper
```

| Flag           | Default | Description                                        |
|----------------|---------|----------------------------------------------------|
| `--providers`  | all     | Comma-separated provider codes to filter by         |
| `--start`      | —       | Start time in UTC: `"YYYYMMDD HH:MM:SS"`           |
| `--end`        | —       | End time in UTC: `"YYYYMMDD HH:MM:SS"`             |
| `--limit`      | `10`    | Maximum number of headlines (1–300)                 |

If the user asks "what's happening with AAPL" or "any news on Tesla", use `ibkr news headlines`.

### Read an article

Each headline includes a `provider_code` and `article_id`. To read the full article:

```bash
ibkr news article BRFG "BRFG$12345" --profile gateway-paper
```

Guide the user to first run `headlines` to get the article ID, then use `article` to read the full text.

## Options

ibkr-cli supports querying options chains and fetching option quotes with greeks.

### List option chains

```bash
ibkr optio

references/setup.md

# Setup and Connectivity

## Step 1: IB Gateway or TWS

ibkr-cli talks to Interactive Brokers through a local API gateway. The user needs one of these running on their machine before anything else works:

- **IB Gateway** (recommended): lightweight, no trading UI, built specifically for API access, uses fewer system resources.
- **TWS (Trader Workstation)**: full trading platform with a graphical interface, also exposes an API.

Either one works. Recommend Gateway unless the user also wants a visual trading interface.

### Installation

Direct the user to download from IBKR's website:

- Gateway: https://www.interactivebrokers.com/en/trading/ibgateway-stable.php
- TWS: https://www.interactivebrokers.com/en/trading/tws-updateless-latest.php

After installing, they need to launch the application and log in with their IBKR account credentials.

### API settings

- **IB Gateway**: API is enabled by default. No action needed. Default ports — live: 4001, paper: 4002.
- **TWS**: API is **not** enabled by default. The user must go to Edit > Global Configuration > API > Settings and check "Enable ActiveX and Socket Clients". Default ports — live: 7496, paper: 7497.

### Choosing a profile

When the user hasn't specified whether they want paper or live trading, verify connectivity in priority order: `gateway-live` (4001) > `live` (7496) > `gateway-paper` (4002) > `paper` (7497). Use `ibkr connect test --profile <name> --json` to check each. The first successful connection is the one to use. Only default to paper if the user explicitly says they want paper trading, or if no live connection is available.

## Step 2: Install ibkr-cli

The CLI requires Python 3.10+. If the user doesn't have Python, help them install it first.

Recommended installation via pipx (isolated environment, won't interfere with other Python packages):

```bash
pipx install ibkr-cli
```

Alternative via pip:

```bash
python -m pip install ibkr-cli
```

Verify it works:

```bash
ibkr --version
```

## Step 3: Verify connectivity

The CLI automatically creates a config file with default profiles on first use — no manual initialization needed. The config file location can be found via `ibkr config-path`, and the user can edit it to customize host, port, or client_id if needed.

The four default profiles are:

| Profile         | Port | Use case              |
|-----------------|------|-----------------------|
| `paper`         | 7497 | TWS paper trading     |
| `live`          | 7496 | TWS live trading      |
| `gateway-paper` | 4002 | IB Gateway paper      |
| `gateway-live`  | 4001 | IB Gateway live       |

Help the user pick the right profile based on which application they're running (Gateway vs TWS) and which mode (paper vs live).

### Run doctor

```bash
ibkr doctor --profile gateway-paper
```

This runs a full health check — TCP reachability and API handshake. If it fails, common causes are:

- Gateway/TWS is not running — ask the user to start it
- Wrong profile — they're using a

Sponsored

Ads related to ibkr-cli and adjacent AI workflows.