ibkr-openclaw
Connect OpenClaw to Interactive Brokers via IB Gateway Docker. Live portfolio data, real-time quotes, historical K-lines, technical analysis, and Telegram alerts — all read-only safe. Use when users ask about IBKR integration, portfolio monitoring, stock analysis, or automated trading alerts.
Best use case
ibkr-openclaw is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Connect OpenClaw to Interactive Brokers via IB Gateway Docker. Live portfolio data, real-time quotes, historical K-lines, technical analysis, and Telegram alerts — all read-only safe. Use when users ask about IBKR integration, portfolio monitoring, stock analysis, or automated trading alerts.
Teams using ibkr-openclaw should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ibkr-openclaw/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ibkr-openclaw Compares
| Feature / Agent | ibkr-openclaw | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Connect OpenClaw to Interactive Brokers via IB Gateway Docker. Live portfolio data, real-time quotes, historical K-lines, technical analysis, and Telegram alerts — all read-only safe. Use when users ask about IBKR integration, portfolio monitoring, stock analysis, or automated trading alerts.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for ChatGPT
Find the best AI skills to adapt into ChatGPT workflows for research, writing, summarization, planning, and repeatable assistant tasks.
AI Agent for Product Research
Browse AI agent skills for product research, competitive analysis, customer discovery, and structured product decision support.
AI Agent for SaaS Idea Validation
Use AI agent skills for SaaS idea validation, market research, customer discovery, competitor analysis, and documenting startup hypotheses.
SKILL.md Source
# IBKR + OpenClaw Integration
Connect OpenClaw to your Interactive Brokers account for live portfolio monitoring, real-time quotes, technical analysis, and automated Telegram alerts.
## Features
- **Live account data** — NAV, cash, P&L, buying power
- **Positions** — all holdings with avg cost and exchange
- **Real-time quotes** — delayed or live market data
- **Historical K-lines** — daily OHLCV data for technical analysis
- **Technical indicators** — RSI, MACD, Bollinger Bands, ATR, MA (via ib_async)
- **Read-only safe** — API configured for read-only access
## Prerequisites
- Interactive Brokers account (live or paper)
- IBKR Mobile app (for 2FA approval)
- Docker & Docker Compose installed on your server
- Python 3.9+ with `ib_async` and `pandas`
## Setup Guide
### Step 1: Install Docker
```bash
curl -fsSL https://get.docker.com | sh
docker --version
docker compose version
```
### Step 2: Clone IB Gateway Docker
The IB Gateway runs in a Docker container based on [gnzsnz/ib-gateway-docker](https://github.com/gnzsnz/ib-gateway-docker).
```bash
cd ~/.openclaw/workspace
git clone https://github.com/gnzsnz/ib-gateway-docker.git
cd ib-gateway-docker
```
### Step 3: Configure Environment
Create a `.env` file in the `ib-gateway-docker` directory:
```env
# IBKR Account
TWS_USERID=your_username
TWS_PASSWORD=your_password
# Trading mode: live or paper
TRADING_MODE=live
# Read-only API (recommended for monitoring)
READ_ONLY_API=yes
# API settings
TWS_ACCEPT_INCOMING=auto
TWS_MASTER_CLIENT_ID=1
# 2FA device name (find in IBKR web portal → Settings → Security)
TWOFA_DEVICE=IB Key
# 2FA timeout
TWOFA_TIMEOUT_ACTION=exit
# Timezone
TIME_ZONE=Asia/Singapore
TZ=Asia/Singapore
# VNC password (optional, for remote desktop)
VNC_SERVER_PASSWORD=your_password
# Auto restart (daily maintenance)
AUTO_RESTART_TIME=23:45
# Save settings between restarts
SAVE_TWS_SETTINGS=yes
```
**Important:** Find your `TWOFA_DEVICE` name in your IBKR web portal under:
Settings → Security → Second Factor Authentication → Devices
### Step 4: Start the Container
```bash
docker compose up -d
```
Check logs:
```bash
docker logs algo-trader-ib-gateway-1 --tail 20
```
### Step 5: Approve 2FA
The Gateway will prompt for 2FA. Approve the notification on your **IBKR Mobile app**.
Once connected, the API is available on:
- **Port 4001** → Paper trading API
- **Port 4002** → Live trading API (read-only if configured)
### Step 6: Install Python Dependencies
```bash
pip install ib_async pandas
```
### Step 7: Test the Connection
```bash
python3 ~/.openclaw/workspace/skills/ibkr-openclaw/scripts/ibkr_client.py summary --port 4001
```
Expected output:
```
Account: ['DU1234567']
----------------------------------------
BuyingPower.............. 500,000.00
NetLiquidation........... 125,000.00
TotalCashValue........... 25,000.00
StockMarketValue......... 100,000.00
FuturesPNL............... -500.00
UnrealizedPnL............ 3,200.00
```
## CLI Usage
### ibkr_client.py — Account, Positions & Quotes
```bash
# Account summary
python3 scripts/ibkr_client.py summary --port 4001
# All positions
python3 scripts/ibkr_client.py positions --port 4001
# Quick NAV
python3 scripts/ibkr_client.py nav --port 4001
# Quote a stock
python3 scripts/ibkr_client.py quote 2800 --exchange SEHK --currency HKD --port 4001
```
### Getting Historical Data (Python)
```python
from ib_async import IB, Stock
ib = IB()
ib.connect('127.0.0.1', 4001, clientId=1, readonly=True)
contract = Stock('2800', 'SEHK', 'HKD', primaryExchange='SEHK')
qualified = ib.qualifyContracts(contract)
bars = ib.reqHistoricalData(
qualified[0], '', '6 M', '1 day', 'TRADES', True, 1
)
for bar in bars[-5:]:
print(f"{bar.date} O:{bar.open} H:{bar.high} L:{bar.low} C:{bar.close} V:{bar.volume}")
ib.disconnect()
```
## API Port Reference
| Port | Mode | Description |
|---|---|---|
| 4001 | Paper | Paper trading API |
| 4002 | Live | Live trading API |
| 5900 | VNC | Remote desktop (if VNC enabled) |
## Troubleshooting
### 2FA not arriving
- Check IBKR Mobile app is logged in with the correct username
- Verify `TWOFA_DEVICE` matches your device name in IBKR web portal
- Check phone notification settings for IBKR app
### Connection timeout
- Ensure the container is running: `docker ps`
- Check logs: `docker logs algo-trader-ib-gateway-1 --tail 20`
- The Gateway restarts daily at 23:45 SGT (configured via `AUTO_RESTART_TIME`)
### Read-only errors
- `READ_ONLY_API=yes` prevents trading but allows all read queries
- Some ib_async features auto-request write access — ignore those errors
- Account summary and positions work fine in read-only mode
### Container won't start
- Check `.env` file has correct credentials
- Ensure ports 4001, 4002, 5900 are not in use: `netstat -tlnp | grep 400`
- Try recreating: `docker compose up -d --force-recreate`
## Security Notes
- `.env` contains your IBKR password in plain text — keep it secure
- `READ_ONLY_API=yes` prevents accidental trades
- VNC is bound to `127.0.0.1` (localhost only) by default
- The container auto-restarts daily to maintain connection
## Architecture
```
┌─────────────┐ ┌──────────────────┐ ┌─────────────┐
│ OpenClaw │────►│ ibkr_client.py │────►│ IB Gateway │
│ Agent │ │ (ib_async) │ │ (Docker) │
└─────────────┘ └──────────────────┘ └──────┬──────┘
│
┌──────▼──────┐
│ IBKR Servers│
│ (live data) │
└─────────────┘
```
## Credits
- [gnzsnz/ib-gateway-docker](https://github.com/gnzsnz/ib-gateway-docker) — IB Gateway Docker image
- [ib_async](https://github.com/ib-api-reloaded/ib_async) — Python IBKR API wrapper (maintained fork of ib_insync)Related Skills
openclaw-youtube
YouTube SERP Scout for agents. Search top-ranking videos, channels, and trends for content research and competitor tracking.
openclaw-search
Intelligent search for agents. Multi-source retrieval with confidence scoring - web, academic, and Tavily in one unified API.
openclaw-media-gen
Generate images & videos with AIsa. Gemini 3 Pro Image (image) + Qwen Wan 2.6 (video) via one API key.
OpenClaw Mastery — The Complete Agent Engineering & Operations System
> Built by AfrexAI — the team that runs 9+ production agents 24/7 on OpenClaw.
openclaw-safe-change-flow
Safe OpenClaw config change workflow with backup, minimal edits, validation, health checks, and rollback. Single-instance first; secondary instance optional.
jqopenclaw-node-invoker
统一通过 Gateway 的 node.invoke 调用 JQOpenClawNode 能力(file.read、file.write、process.exec、process.manage、system.run、process.which、system.info、system.screenshot、system.notify、system.clipboard、system.input、node.selfUpdate)。当用户需要远程文件读写、文件移动/删除、目录创建/删除、进程管理(列表/搜索/终止)、远程进程执行、命令可执行性探测、系统信息采集、截图采集、系统弹窗、系统剪贴板读写、输入控制(鼠标/键盘)、节点自更新、节点命令可用性排查或修复 node.invoke 参数错误时使用。
openclaw-stock-skill
使用 data.diemeng.chat 提供的接口查询股票日线、分钟线、财务指标等数据,支持 A 股等市场。
openclaw-whatsapp
WhatsApp bridge for OpenClaw — send/receive messages, auto-reply agents, QR pairing, message search, contact sync
polymarket-openclaw-trader
Reusable Polymarket + OpenClaw trading operations skill for any workspace. Use when the user needs to set up, run, tune, monitor, and deploy an automated Polymarket trading project (paper/live), including env configuration, risk controls, reporting, and dashboard operations.
openclaw-version-monitor
监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明
openclaw-essesseff
Interact with the essesseff DevOps platform — call the essesseff Public API (templates, organizations, apps, deployments, images, image lifecycle, environments, retention policies, packages) and automate app creation and Argo CD setup using the essesseff onboarding utility. Use when the user wants to create essesseff apps, manage deployments, promote images through the DEV→QA→STAGING→PROD lifecycle, configure Argo CD environments, manage retention policies, or run the essesseff-onboard.sh script.
Agent World Protocol — OpenClaw Skill
Connect to the Agent World Protocol (AWP) — a persistent open world where AI agents trade real SOL tokens, build structures, claim land, form guilds, complete bounties, fight for territory, and interact with the real economy.