calendar
Report scheduled US economic events (CPI, NFP, FOMC, GDP, PCE, ISM, jobless claims...) with times in ET, impact,…
Fetch trade executions from Interactive Brokers filtered by account, date range, or symbol. Supports live API (~7 days history) and FlexReport (full history). Use when user asks about their trades, executions, or transaction history. Requires TWS or IB Gateway running locally.
Claude Code
$ npx -y skills add staskh/trading_skills --skill ib-trades-history --agent claude-code
Codex
$ npx skills add staskh/trading_skills --skill ib-trades-history -a codex -y
Cursor
$ npx skills add staskh/trading_skills --skill ib-trades-history -a cursor -y
Gemini CLI
$ npx skills add staskh/trading_skills --skill ib-trades-history -a gemini-cli -y
GitHub Copilot
$ npx skills add staskh/trading_skills --skill ib-trades-history -a github-copilot -y
OpenCode
$ npx skills add staskh/trading_skills --skill ib-trades-history -a opencode -y
Windsurf
$ npx skills add staskh/trading_skills --skill ib-trades-history -a windsurf -y
name: ib-trades-history description: Fetch trade executions from Interactive Brokers filtered by account, date range, or symbol. Supports live API (~7 days history) and FlexReport (full history). Use when user asks about their trades, executions, or transaction history. Requires TWS or IB Gateway running locally. dependencies: ["trading-skills"]
Fetch trade executions from Interactive Brokers.
TWS or IB Gateway must be running locally with API enabled:
**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.
For full trade history beyond ~7 days, the user needs a Flex Web Service token and a pre-configured Trade query in IBKR Account Management.
> **Note:** If `uv` is not installed or `pyproject.toml` is not found, replace `uv run python` with `python` in all commands below.
# Recent trades (last ~7 days via API) uv run python .claude/skills/ib-trades-history/scripts/trades.py --all-accounts # Filter by symbol uv run python .claude/skills/ib-trades-history/scripts/trades.py --all-accounts --symbol AAPL # Full history via FlexReport uv run python .claude/skills/ib-trades-history/scripts/trades.py --all-accounts --flex-token YOUR_TOKEN --flex-query-id YOUR_QUERY_ID # Custom date range (FlexReport) uv run python .claude/skills/ib-trades-history/scripts/trades.py --all-accounts --flex-token TOKEN --flex-query-id QID --start-date 2025-01-01 --end-date 2025-12-31 # Multiple queries (e.g., one per year to exceed 365-day limit) uv run python .claude/skills/ib-trades-history/scripts/trades.py --all-accounts --flex-token TOKEN --flex-query-id QID_2025 --flex-query-id QID_2026 --start-date 2025-01-01 --end-date 2026-12-31 # From local FlexReport XML files (no TWS/Gateway needed) uv run python .claude/skills/ib-trades-history/scripts/trades.py --file trades_2024.xml --file trades_2025.xml --symbol TSLA # Mix files with date filtering uv run python .claude/skills/ib-trades-history/scripts/trades.py --file exports/2025.xml --start-date 2025-06-01 --end-date 2025-12-31 # Group option fills into vertical spreads (credit, width, max risk, capture %, RoR) uv run python .claude/skills/ib-trades-history/scripts/trades.py --file exports/2026.xml --symbol NDX --group-spreads
**Default behavior** (no flags): fetches trades for the first managed account from the live API. **Always use `--all-accounts`** unless the user asks for a specific account.
`--flex-token` / `--flex-query-id` may be omitted when `IB_FLEX_TOKEN` / `IB_FLEX_QUERY_ID` are set in the environment or `.env` (see `env.template`). Flags win over env vars.
| Scenario | Source | Date Range | |---|---|---| | No flex args | `reqExecutionsAsync` | **Current session only** | | `--flex-token` + `--flex-query-id` | `FlexReport` (web) | As configured in query | | `--file` | `file` (local XML) | Full file contents |
When using the live API, a `data_limitation` warning is included in the output.
**The live API returns only the current TWS session**, despite the "~7 days" the API docs imply — it yields 0 executions on a weekend or for any prior-day lookback, which looks identical to "no trades." Setting `ExecutionFilter.time` does not widen it. For anything beyond today, use FlexReport. The web service is also aggressively rate-limited ("Statement could not be generated at this time" = throttled, roughly one generation per query per 10–15 min); for large lookbacks prefer a manual XML export via `--file`.
Turns raw fills into the trade-level view: a 10-lot order routed across five exchanges is one leg, and its opening and closing legs are one spread.
Requires the `openCloseIndicator` field, which **only FlexReport sources provide**. On the live API path the output carries `spread_grouping.supported = false` with a reason rather than guessing which fills opened versus closed.
Legs are keyed on `(account, symbol, expiry, right)` — deliberately *not* trade date, so a spread opened one session and settled the next keeps its closing legs.
Anything that is not an unambiguous two-strike vertical is left in `ungrouped_legs` with a reason in `spread_grouping.warnings`, never force-fit into a bogus spread: rolls, ratio spreads, multiple verticals on one expiry/right, single legs, positions still open, and closes whose open predates the window.
`spread_grouping.reconciled` asserts that spread P&L plus ungrouped P&L equals the raw execution P&L — check it before trusting a report.
Returns JSON with:
Most retail traders juggle 5+ tabs — broker, charting platform, screener, news feed, spreadsheet — just to decide whether to enter a trade. This project collapses all of that into a single conversational interface powered by Claude.
Report scheduled US economic events (CPI, NFP, FOMC, GDP, PCE, ISM, jobless claims...) with times in ET, impact,…
Get upcoming earnings dates with timing (before/after market) and EPS estimates. Use when user asks about earnings dates,…
Get fundamental financial data including financials, earnings, and key metrics. Use when user asks about financials, earnings,…
Calculate option Greeks (delta, gamma, theta, vega) and implied volatility for specific options. Use when user asks about Greeks,…
Get account summary from Interactive Brokers including cash balance, buying power, and account value. Use when user asks about…
Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…