ib-portfolio — скилл для Claude Code: что делает и как установить
Скилл ib-portfolio для Claude Code запрашивает открытые позиции и баланс из Interactive Brokers. Агент запускает скрипт при вопросах о купленных акциях, структуре портфеля или текущих активах на счёте.
MIT 107 установок ★ 417 обновлён 2026-10-21
npx skills add staskh/trading_skills --skill ib-portfolio -a claude-codeЧто делает ib-portfolio
Инструмент считывает текущие позиции брокерского счёта через локальный скрипт scripts/portfolio.py. Скрипт возвращает JSON со списком тикеров, количеством бумаг, средней ценой покупки, рыночной стоимостью и нереализованной прибылью или убытком. Все временные метки генерируются в часовом поясе America/New_York.
Для работы нужен запущенный локально терминал TWS или IB Gateway с включённым API и библиотека ib-async. По умолчанию скрипт обращается к порту 7497 для демо-счёта, а при сбое пробует порт 7496 для реального счёта. Если задана переменная окружения IB_PORT или передан аргумент --port, приоритет отдаётся флагу. Без запущенного шлюза TWS связь установить не удастся.
Какие задачи решает
- получить список открытых позиций из Interactive Brokers
- проверить нереализованную прибыль по купленным акциям
- выбрать конкретный субсчёт с помощью параметра --account
Примеры запросов агенту
- Покажи мои открытые позиции в Interactive Brokers
- Какие акции сейчас есть на счёте и какой по ним PnL?
- Выведи состав портфеля для аккаунта через порт 7496
Как установить ib-portfolio
1Через Skills CLI (Vercel)
npx skills add staskh/trading_skills --skill ib-portfolio -a claude-code2Вручную: положить файлы
~/.claude/skills/ib-portfolio/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/ib-portfolio/
1Через Skills CLI (Vercel)
npx skills add staskh/trading_skills --skill ib-portfolio -a codex2Вручную: положить файлы
.agents/skills/ib-portfolio/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add staskh/trading_skills --skill ib-portfolio -a cursor2Вручную: положить файлы
.cursor/skills/ib-portfolio/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install staskh/trading_skills .claude/skills/ib-portfolio2Вручную: положить файлы
.github/skills/ib-portfolio/SKILL.md1Через Skills CLI (Vercel)
npx skills add staskh/trading_skills --skill ib-portfolio -a gemini-cli2Командой платформы
gemini skills install https://github.com/staskh/trading_skills --path .claude/skills/ib-portfolioВручную: положить файлы
.devin/skills/ib-portfolio/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add staskh/trading_skills --skill ib-portfolio -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы об ib-portfolio
Как установить ib-portfolio в Claude Code?
Выполните команду npx skills add staskh/trading_skills --skill ib-portfolio -a claude-code. Конфигурация сохранится в файле ~/.claude/skills/ib-portfolio/SKILL.md.
Что делает ib-portfolio?
Скилл опрашивает Interactive Brokers и передаёт агенту список бумаг, объёмы, средние цены и рыночную стоимость позиций в формате JSON.
Что нужно для работы ib-portfolio?
Требуются запущенный локально TWS или IB Gateway с разрешённым API, библиотека ib-async, а также Python или пакетный менеджер uv.
Исходный текст
SKILL.md · MIT
--- name: ib-portfolio description: 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. dependencies: ["trading-skills"] --- # 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. ```bash 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.
© staskh · MIT · staskh/trading_skills