
Pulls your Interactive Brokers trade executions with flexible filtering by account, symbol, and date range. The live API gives you about seven days of history, which is fine for recent activity, but if you need older trades you'll use FlexReport queries or local XML exports. Smart design here is the ability to chain multiple queries or files to get around IB's 365-day limit per query. Requires TWS or IB Gateway running locally unless you're working from exported files. Returns structured JSON with both individual executions and aggregated summaries per symbol, including commissions and realized P&L. If you're building trading analysis tools or just need to answer "what did I actually pay for those AAPL shares last month," this handles the IBKR connectivity pain for you.
$ npx -y skills add staskh/trading_skills --skill ib-trades-history --agent claude-codeInstalls into .claude/skills of the current project.
Fetch trade executions from Interactive Brokers.
TWS or IB Gateway must be running locally with API enabled:
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.
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
uvis not installed orpyproject.tomlis not found, replaceuv run pythonwithpythonin all commands below.
Sponsors