FlokieW

IBKR Trading

AI 智能体v1.0.0
作者:FlokieW更新于 2026-05-18ibkr-trader
#Trading

据 AlphaMoat 统计,截至 2026-09,IBKR Trading 累计下载 4,256 次、获 12 个星标,在全部 5,078 个 AI 技能中排名第 2,329 位,在「AI 智能体」分类(969 个)中排名第 452 位。

累计安装
144
累计下载
4,256
星标
12
全站排名
#2,329
全站前 46% · 「AI 智能体」前 47%
平台累计安装累计下载星标评论
ClawHub ↗1444,25612-

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

使用 IBeam 与 IBKR Key 完成认证,查询账户、持仓与行情,提交和管理订单。需实盘或模拟账户、手机 IBKR Key,以及具备 Java 11+、Chrome/Chromium 的 Linux 环境和相关依赖。用户约需在 2 分钟内批准手机通知;会话约 24 小时过期,可保活或重新认证,重新认证仍需手机批准。

资料发布于 2026-10-26

可以用来做什么

  • 监控 IBKR 账户与持仓

什么时候用

  • 已配置 IBKR Gateway 且能完成手机认证时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

检查当前 IBKR 认证状态并查询持仓

月度数据趋势

累计下载4,256
3,5973,9514,3052026-05 · 累计下载 3,6462026-07 · 累计下载 4,0592026-08 · 累计下载 4,1642026-09 · 累计下载 4,25626-0526-09
星标12
1112132026-05 · 星标 122026-07 · 星标 122026-08 · 星标 122026-09 · 星标 1226-0526-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,256—12
2026-084,164+2.6%12
2026-074,059—12
2026-053,646—12

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

4.1 KB · ClawHub v1.0.0
---
name: ibkr-trading
description: Interactive Brokers (IBKR) trading automation via Client Portal API. Use when setting up IBKR account access, authenticating sessions, checking portfolio/positions, or building trading bots. Handles IBeam automated login with IBKR Key 2FA.
---

# IBKR Trading Skill

Automate trading with Interactive Brokers using the Client Portal Gateway API.

## Overview
展开全部(共 174 行)

This skill enables:
- Automated IBKR authentication via IBeam + IBKR Key
- Portfolio and position monitoring
- Order placement and management
- Building custom trading strategies

## Prerequisites

- IBKR account (live or paper)
- IBKR Key app installed on phone (for 2FA)
- Linux server with Java 11+ and Chrome/Chromium

## Quick Setup

### 1. Install Dependencies

```bash
# Java (for Client Portal Gateway)
sudo apt-get install -y openjdk-17-jre-headless

# Chrome + ChromeDriver (for IBeam)
sudo apt-get install -y chromium-browser chromium-chromedriver

# Virtual display (headless auth)
sudo apt-get install -y xvfb

# Python venv
python3 -m venv ~/trading/venv
source ~/trading/venv/bin/activate
pip install ibeam requests
```

### 2. Download Client Portal Gateway

```bash
cd ~/trading
wget https://download2.interactivebrokers.com/portal/clientportal.gw.zip
unzip clientportal.gw.zip -d clientportal
```

### 3. Configure Credentials

Create `~/trading/.env`:
```bash
IBEAM_ACCOUNT=your_username
IBEAM_PASSWORD='your_password'
IBEAM_GATEWAY_DIR=/path/to/trading/clientportal
IBEAM_CHROME_DRIVER_PATH=/usr/bin/chromedriver
IBEAM_TWO_FA_SELECT_TARGET="IB Key"
```

## Authentication

### Start Gateway + Authenticate

```bash
# 1. Start Client Portal Gateway
cd ~/trading/clientportal && bash bin/run.sh root/conf.yaml &

# 2. Wait for startup (~20 sec)
sleep 20

# 3. Run IBeam authentication
cd ~/trading
source venv/bin/activate
source .env
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x24 &
python -m ibeam --authenticate
```

**Important:** User must approve IBKR Key notification on phone within ~2 minutes!

### Check Auth Status

```bash
curl -sk https://localhost:5000/v1/api/iserver/auth/status
```

Authenticated response includes `"authenticated": true`.

## API Usage

### Account Info

```bash
# List accounts
curl -sk https://localhost:5000/v1/api/portfolio/accounts

# Account summary
curl -sk "https://localhost:5000/v1/api/portfolio/{accountId}/summary"
```

### Positions

```bash
# Current positions
curl -sk "https://localhost:5000/v1/api/portfolio/{accountId}/positions/0"
```

### Market Data

```bash
# Search for symbol
curl -sk "https://localhost:5000/v1/api/iserver/secdef/search?symbol=AAPL"

# Get quote (after searching)
curl -sk "https://localhost:5000/v1/api/iserver/marketdata/snapshot?conids=265598&fields=31,84,86"
```

### Place Orders

```bash
curl -sk -X POST "https://localhost:5000/v1/api/iserver/account/{accountId}/orders" \
  -H "Content-Type: application/json" \
  -d '{
    "orders": [{
      "conid": 265598,
      "orderType": "MKT",
      "side": "BUY",
      "quantity": 1,
      "tif": "DAY"
    }]
  }'
```

## Session Management

Sessions expire after ~24 hours. Options:

1. **Keepalive cron** - Ping `/v1/api/tickle` every 5 min
2. **Auto re-auth** - Run IBeam when session expires (requires phone approval)

### Keepalive Script

```python
import requests
import urllib3
urllib3.disable_warnings()

def keepalive():
    try:
        r = requests.post("https://localhost:5000/v1/api/tickle", verify=False, timeout=10)
        status = requests.get("https://localhost:5000/v1/api/iserver/auth/status", verify=False, timeout=10)
        return status.json().get("authenticated", False)
    except:
        return False
```

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Gateway not responding | Check if Java process is running: `ps aux \| grep GatewayStart` |
| Login timeout | User didn't approve IBKR Key in time - retry auth |
| Connection refused | Gateway not started - run `bin/run.sh root/conf.yaml` |
| Chrome errors | Ensure Xvfb is running: `Xvfb :99 &` and `export DISPLAY=:99` |

## Files Reference

See `references/api-endpoints.md` for complete API documentation.
See `scripts/` for ready-to-use automation scripts.

「AI 智能体」分类下的热门技能

self-improving agentAI 智能体

记录自身发现以实现自我改进的技能

↓ 129.0万★ 4,521pskoett
Find SkillsAI 智能体

帮助用户发现和安装智能体技能,当用户询问如「如何做X」、「找X的技能」、「有能做...的吗」等问题时

↓ 110.3万★ 1,778桂皮
Agent BrowserAI 智能体

给 AI agent 用的浏览器自动化命令行技能。

↓ 90.9万★ 991Nicolas Kleiber
Self-Improving + Proactive AgentAI 智能体

自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。

↓ 44.4万★ 1,606Iván
Skill VetterAI 智能体

在安装第三方技能之前,按清单审查来源、权限与危险模式的技能。

↓ 33.0万★ 1,323spclaudehome
ontologyAI 智能体

类型化知识图谱,用于结构化智能体记忆与可组合技能。适用于以下场景:创建/查询实体(人物、项目、任务、事件、文档)、关联相关对象、强制执行约束、将多步操作规划为图谱变换,或当技能需要共享状态时。触发关键词包括"记住""我知道关于什么""将X链接到Y""显示依赖关系"、实体增删改查操作,以及跨技能数据访问。

↓ 29.4万★ 788oswalpalash
Proactive AgentAI 智能体

将 AI 代理从任务执行者转变为能够预见需求、持续优化的主动伙伴。现已支持 WAL Protocol、Working Buffer、Autonomous Crons 及经过实战验证的模式。属于 Hal Stack 🦞。

↓ 28.8万★ 913halthelobster
Skill CreatorAI 智能体

创建有效技能指南。当用户希望创建新技能(或更新现有技能)以利用专业知识、工作流程或工具集成扩展 Claude 的能力时,应使用此技能。

↓ 23.8万★ 473chindden

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。