From ibkr-trade-analyzer
Analyzes Interactive Brokers trading history, Flex Query data, and activity statements for account summaries, P&L, win rate, Sharpe ratio, drawdown, commissions, cost basis, and cash/FX exposure. Read-only, no trade execution.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ibkr-trade-analyzer:ibkr-trade-analyzerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze Interactive Brokers trading history using **read-only** MCP tools. Follow the user's language for the response.
scripts/USAGE.mdscripts/analyzers/__init__.pyscripts/analyzers/china_tax.pyscripts/analyzers/cost.pyscripts/analyzers/diluted_cost.pyscripts/analyzers/fx.pyscripts/analyzers/lifo.pyscripts/analyzers/pnl.pyscripts/analyzers/portfolio.pyscripts/analyzers/price.pyscripts/analyzers/trade.pyscripts/ibkr_analyzer.pyscripts/loader.pyscripts/models.pyscripts/report.pyAnalyze Interactive Brokers trading history using read-only MCP tools. Follow the user's language for the response.
This skill is an intent router: identify what the user wants, load data once, call the smallest set of tools that answers the question, and present a structured report.
Before any analysis, ensure data is loaded:
ibkr_fetch_data(mode="flex").ibkr_fetch_data(mode="file", source="/path/to/activity.xml").claude plugin configure ibkr-trade-analyzer.Data is cached in the MCP server session only while it is fresh for the current local date. The server may reload from today's XML cache or refresh Flex data when the in-memory session is stale. Do not force reload unless the user asks for force_refresh, uses /ibkr-trade-analyzer:portfolio --ff, or changes the source file.
| User Intent | Examples | Preferred Tool or Command Workflow |
|---|---|---|
| Account summary | summary report, 一页纸总结, quick review, 账户摘要 | ibkr_pnl_summary + ibkr_portfolio + ibkr_cost_analysis; use /ibkr-trade-analyzer:summary when slash commands are available |
| Portfolio / positions | holdings, position sizing, 仓位, 持仓, concentration | ibkr_portfolio; use /ibkr-trade-analyzer:portfolio when available, or /ibkr-trade-analyzer:portfolio --ff when the user asks to force fresh Flex data |
| Cash and FX | cash balance, FX exposure, 现金换汇建议, currency exposure | ibkr_portfolio + ibkr_fx_analysis + ibkr_cost_analysis; use /ibkr-trade-analyzer:cash-fx when available |
| P&L performance | realized P&L, Sharpe, drawdown, monthly returns, 盈亏 | ibkr_pnl_summary |
| Trading behavior | win rate, frequency, holding period, profit factor, 交易习惯 | ibkr_trade_patterns |
| Costs and fees | commissions, interest, dividends, fee drag, 手续费 | ibkr_cost_analysis |
| China tax evidence | 中国个税, 境外所得, 外税抵免, 1042-S, 年度报税 | ibkr_china_tax_annual_calc; use china-tax skill and /ibkr-trade-analyzer:china-tax-annual for official-source annual workflows |
| China tax planning | 年前税务优化, year-end China tax planning, evidence readiness | use china-tax skill and /ibkr-trade-analyzer:china-tax-year-end-plan for neutral review workflows |
| Cost basis | breakeven, 保本价, 摊薄成本, FIFO, LIFO | ibkr_analyze(sections=["diluted_cost"]) |
| Full report | generate report, export HTML, 导出报告 | ibkr_generate_report; use /ibkr-trade-analyzer:report when available |
| Filtered advanced analysis | date range, asset type, STK/OPT only | ibkr_analyze(sections=[...], period="YYYY-MM-DD:YYYY-MM-DD", asset_types="STK,OPT"); use /ibkr-trade-analyzer:analyze when available; china_tax is opt-in only |
Ask one clarifying question only when the data source or intended section cannot be inferred.
| Tool | Use When |
|---|---|
ibkr_fetch_data | First call — loads Flex API data or a local CSV/XML file. |
ibkr_analyze | Filtered or multi-section analysis with optional period and asset_types. |
ibkr_portfolio | Portfolio snapshot: positions, cash, allocation, concentration, risk score. |
ibkr_pnl_summary | P&L overview: total, Sharpe, drawdown, monthly returns, winners/losers. |
ibkr_trade_patterns | Trading behavior: win rate, frequency, holding periods, profit factor. |
ibkr_fx_analysis | FX conversion history, average rates, ranges, FX commissions. |
ibkr_cost_analysis | Commissions, interest, dividends, and fee-to-P&L ratio. |
ibkr_china_tax_annual_calc | Informational China resident annual dividend/withholding estimate from IBKR Flex data and IBKR FX evidence; requires tax_year unless data dates allow inference. |
ibkr_generate_report | Generate Markdown and HTML report files. |
ibkr_china_tax_annual_calc and ibkr_analyze(sections=["china_tax"]) support opt-in STK realized P&L evidence with include_realized_pnl=True, realized_pnl_asset_types=["STK"], and china_iit_property_transfer_rate when the user explicitly requests realized-gain review.
Use this format for account summaries:
Use this format for holdings and position sizing:
Use this format for currency questions:
Currency exposures to review, Operational balances to review, Monitor.scripts/USAGE.md — standalone CLI usage, analyzer sections, cache behavior, and local file workflows.scripts/ibkr_analyzer.py — standalone read-only CLI wrapper for generating reports outside MCP workflows.Flex credentials not configured — run claude plugin configure ibkr-trade-analyzer.Token expired — reconfigure the plugin with a new Flex token.npx claudepluginhub esonhugh/ibkr-trade-analyzer --plugin ibkr-trade-analyzerGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Resolves in-progress git merge or rebase conflicts by analyzing history, understanding intent, and preserving both changes where possible. Runs automated checks after resolution.