skillfed

ib-portfolio

IB Portfolio connects to your Interactive Brokers account to display current positions, quantities, average costs, and market values. It works with TWS or IB Gateway running locally and automatically handles paper and live trading ports. The skill returns structured position data including unrealized profit/loss for each holding.

IB Portfolio retrieves your current positions and holdings directly from Interactive Brokers.

AI-generated summary based on this skill's SKILL.md

299 68 MIT updated by staskh

Install

staskh/trading_skills/ib-portfolio · repository language: Python

git clone https://github.com/staskh/trading_skills
cp -r trading_skills/.claude/skills/ib-portfolio ~/.claude/skills/ib-portfolio
npx skillfed install staskh/trading_skills/ib-portfolio

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What stocks do I own in IB using ib-portfolio?

ib-portfolio retrieves your current stock holdings directly from Interactive Brokers. It connects to TWS or IB Gateway running locally and displays each position with its quantity, average cost, and current market value. The skill automatically detects whether you're using paper or live trading and connects to the appropriate port.

How does ib-portfolio get my current positions from Interactive Brokers?

ib-portfolio connects to your local TWS or IB Gateway instance to fetch live account data. It queries your Interactive Brokers account and returns structured position information including stock symbols, quantities held, average purchase costs, and unrealized gains or losses for each holding.

Can ib-portfolio show unrealized gains and losses?

Yes. ib-portfolio displays the market value and unrealized profit/loss for each position in your account. This lets you see at a glance how each holding is performing relative to your average cost basis.

What do I need to run ib-portfolio?

ib-portfolio requires TWS (Trader Workstation) or IB Gateway running locally on your machine. The skill automatically handles connection to both paper and live trading ports, so you don't need to configure the port manually. Your Interactive Brokers account must be logged in and active.

Does ib-portfolio work with multiple Interactive Brokers accounts?

ib-portfolio connects to whichever account is currently logged into your local TWS or IB Gateway instance. To check positions across multiple accounts, you would need to switch the logged-in account in TWS/Gateway and run the skill again.

SKILL.md

rendered from the published skill — quoted content, verbatim

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

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 2 files
.claude/skills/ib-portfolio/SKILL.md
.claude/skills/ib-portfolio/scripts/portfolio.py

Related skills

Tags

brokerage-integration position-tracking portfolio-snapshot trading-account-access market-holdings-viewer