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
累計下載
4256
星標
12
全站排名
#2,329
全站前 46% · 「AI 智慧體」前 47%
平台累計安裝累計下載星標評論
ClawHub ↗144425612-

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

使用 IBeam 與 IBKR Key 完成認證,查詢帳戶、持倉與行情,提交和管理訂單。需實盤或模擬帳戶、手機 IBKR Key,以及具備 Java 11+、Chrome/Chromium 的 Linux 環境和相關依賴。使用者約需在 2 分鐘內核准手機通知;工作階段約 24 小時過期,可保活或重新認證,重新認證仍需手機核准。

資料釋出於 2026-10-26

可以用來做什麼

  • 監控 IBKR 帳戶與持倉

什麼時候用

  • 已設定 IBKR Gateway 且能完成手機認證時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

檢查當前 IBKR 認證狀態並查詢持倉

月度資料趨勢

累計下載4256
3597395143052026-05 · 累計下載 36462026-07 · 累計下載 40592026-08 · 累計下載 41642026-09 · 累計下載 425626-0526-09
星標12
1112132026-05 · 星標 122026-07 · 星標 122026-08 · 星標 122026-09 · 星標 1226-0526-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-094256—12
2026-084164+2.6%12
2026-074059—12
2026-053646—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萬★ 4521pskoett
Find SkillsAI 智慧體

幫助使用者發現和安裝智慧體技能,當用戶詢問如「如何做X」、「找X的技能」、「有能做...的嗎」等問題時

↓ 110.3萬★ 1778桂皮
Agent BrowserAI 智慧體

給 AI agent 用的瀏覽器自動化命令列技能。

↓ 90.9萬★ 991Nicolas Kleiber
Self-Improving + Proactive AgentAI 智慧體

自我反思+自我批評+自我學習+自組織記憶。智慧體評估自身工作、發現錯誤並持續改進。

↓ 44.4萬★ 1606Iván
Skill VetterAI 智慧體

在安裝第三方技能之前,按清單審查來源、許可權與危險模式的技能。

↓ 33萬★ 1323spclaudehome
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),按月更新。口徑說明見資料方法。