Pulls your account summary from Interactive Brokers through their API. You ask Claude about your balance or buying power, and this hits your local TWS or IB Gateway instance to grab cash balance, net liquidation, and buying power. Defaults to port 7496 for live trading, 7497 for paper. One gotcha: it fetches only your first managed account unless you pass the all-accounts flag, so if you're managing multiple accounts, you'll want to be explicit about that. Returns clean JSON with connection status and account data. Requires your TWS or Gateway running locally with API access enabled, which is standard if you're already automating trades through IB.

GitHub stars
248
last updated
Jun 11, 2026

Install

$ npx -y skills add staskh/trading_skills --skill ib-account --agent claude-code

Installs into .claude/skills of the current project.

Files

IB Account

Fetch account summary from Interactive Brokers.

IB Connection

TWS or IB Gateway must be running locally with API enabled:

  • Paper trading — port 7497
  • Live trading — port 7496
  • IB_PORT env var — default port when --port is omitted (e.g. IB_PORT=4001 for a Gateway container). Precedence: --port flag > IB_PORT > built-in default. Set it in the shell or a .env file.

Port fallback: If the configured port fails, automatically retry on the other port. If the retry succeeds, save to memory which account type worked (live/paper) and reuse it for all IB skill calls in this and future sessions — until the user explicitly asks for the other account. If both ports fail, ask the user to verify that TWS or IB Gateway is running with API access enabled.

Instructions

Note: If uv is not installed or pyproject.toml is not found, replace uv run python with python in all commands below.

uv run python scripts/account.py [--port PORT] [--account ACCOUNT_ID] [--all-accounts]

Arguments

Sponsors

Details

Repository
github.com/staskh/trading_skills
Categories
Backend & APIs, Finance & Trading
License
MIT
First seen
Jun 11, 2026

More from staskh/trading_skills

All 28
1staskh avatarib-option-chainstaskh/trading_skillsGet option chain data from Interactive Brokers including calls and puts with strikes, bids, asks, volume, and implied volatility. Use when user asks about optio0skills.sh installs
2staskh avatarib-portfoliostaskh/trading_skillsGet portfolio positions from Interactive Brokers. Use when user asks about their portfolio, positions, holdings, or what stocks they own. Requires TWS or IB Gat0skills.sh installs
3staskh avatarib-stop-lossstaskh/trading_skillsDownside stop-loss management for PMCC, naked LEAPS, and stock positions in IB. Computes stop prices, detects alerts, and places conditional combo orders. Dry-r0skills.sh installs
4telagod avatardesigning-architecturestelagod/code-abyssArchitecture knowledge reference covering API design, security architecture, cloud-native patterns, caching strategies, message queues, and data security. Use w0skills.sh installs
5teng-lin avatarnotebooklmteng-lin/notebooklm-pyComplete API for Google NotebookLM - full programmatic access including features not in the web UI. Create notebooks, add sources, generate all artifact types, 0skills.sh installs
6ThinkInAIXYZ avataradd-providerThinkInAIXYZ/deepchatAdd a DeepChat LLM provider through explicit reviewed source changes. Use when a developer asks Codex to add a provider, provider profile, upstream provider con0skills.sh installs