staskh/trading_skills

ib-portfolio

Get portfolio positions from Interactive Brokers. Use when user asks about their portfolio, positions, holdings, or what stocks they own. Requires TWS or IB Gateway running locally.

First seen Mar 1, 2026

Installation

$ npx skills add staskh/trading_skills --skill ib-portfolio

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from staskh/trading_skills · top by installs.

npx skills add staskh/trading_skills

Browse all from staskh/trading_skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 362
License LICENSE
Default branch main
Open issues 15
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,890 B
  • docs SUMMARY.md 201 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 86 installs

SKILL.md

IB Portfolio

Fetch current portfolio positions from Interactive Brokers.

IB Connection

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

  • Paper trading — port 7497
  • Live trading — port 7496
  • IBPORT env var — default port when --port is omitted (e.g. IBPORT=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/portfolio.py [--port PORT]

Arguments

  • --port - IB port (default: 7497 for paper trading)
  • --account - Specific IB account ID (optional, defaults to first account)

Output

Returns JSON with:

  • connected - Whether connection succeeded
  • positions - Array of positions with symbol, quantity, avgcost, marketvalue, unrealized_pnl

If not connected, explain that TWS/Gateway needs to be running.

Dependencies

  • ib-async

Timezone

All timestamps and time-based calculations must use the America/NewYork timezone. All JSON output must include generatedat (NY time string) and data_delay fields.