Skip to content
alyn
staskh

Ib Portfolio skill

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.

$npx skills add staskh/trading_skills --skill ib-portfolio
View this skill on GitHubstaskh/trading_skills/.claude/skills/ib-portfolio/SKILL.md
Pack stars
407
Pack installs
3.1k
Alyn Score
52/99
Updated
2 days ago
License
MIT
– views – installs via Alyn

Install Ib Portfolio

Pick your agent. Every command is ready to paste.

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

The open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.

01

Install it

Run the command above, or upload the folder in Claude.

02

Ask naturally

Describe the task. Your agent loads ib-portfolio when the request matches its description.

03

Name it if needed

If it does not trigger, say “use the ib-portfolio skill”. In Codex, type $ib-portfolio.

The skill itself

SKILL.md

FolderGitHub

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
  • 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/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, avg_cost, market_value, 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/New_York timezone. All JSON output must include generated_at (NY time string) and data_delay fields.

Tips for Ib Portfolio

  • • Start a fresh session after installing so your agent picks up the new skill.
  • • This skill ships scripts. Read them before the first run, and run it in a project without secrets first.
  • • It is part of a pack with 30 skills. Install only the ones you need with --skill to keep triggers precise.
  • • If two skills overlap, mention the one you want by name.

Questions about Ib Portfolio

What does the Ib Portfolio skill do?

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.

How do I install Ib Portfolio?

Run "npx skills add staskh/trading_skills --skill ib-portfolio" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.

Does Ib Portfolio work in Cursor and Codex?

Yes. Ib Portfolio uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.

Is Ib Portfolio free?

Ib Portfolio is open source on GitHub under the MIT license. It is free to install; check the license before commercial use.

Who made Ib Portfolio?

Ib Portfolio is published by staskh in the staskh/trading_skills repository, together with 29 other skills.

Similar skills. From other creators.