Guide
Exporting your portfolio from Interactive Brokers (Flex Queries)
Three export routes, one clearly better default for portfolio tracking — configured step by step.
Last updated: 22 July 2026 · By The Acutic Research Team
Interactive Brokers has the opposite problem of most retail brokers. Where others make you fight for a CSV file, IBKR offers so much export machinery that the real question is which door to walk through. There are three: the Activity Statement, a human-readable account report; the Flex Query, a saved, field-level report template you configure once and re-run forever; and the Flex Web Service, a token-based interface that lets software fetch a Flex Query without you logging in. For feeding a portfolio tracker, the Flex Query is the standard answer — it is the format most import tools are built around. This guide sets one up step by step, explains the CSV-vs-XML choice, covers the Activity Statement alternative, and ends with the quirks that actually break imports: multi-currency rows, dividend accruals and corporate actions.
What a Flex Query is
IBKR's own documentation describes Flex Queries as “highly customizable report templates for Activity Statements and Trade Confirmation Reports” that let you specify exactly which fields you want, the period, the field order and the output format (IBKR Client Portal guide, retrieved July 2026). The crucial word is template. An Activity Statement is a document you generate; a Flex Query is a definition you keep. Once saved, it appears in your list with a query ID, and every run produces a fresh file with the same structure — which is precisely what a tracker's importer wants: a stable schema it can map once.
Two types exist. The Activity Flex Query reports what happened in the account — trades, cash movements, open positions, dividends, fees. The Trade Confirmation Flex Query reproduces per-execution confirmations. For portfolio tracking you want the Activity variant; the rest of this guide means that one.
Step by step: a Flex Query for trades, positions and dividends
The steps below follow the documented Client Portal flow (Create an Activity Flex Query, retrieved July 2026) and the section list that the Portfolio Performance manual documents for its IBKR importer — a sensible baseline for any tracker.
- Sign in to Client Portal and open Performance & Reports → Flex Queries. The same page is reachable via Menu → Reporting → Flex Queries.
- Create a new Activity Flex Query — click the + icon in the Activity Flex Query panel and give the query a name you will still understand next year (“Tracker export — full”).
- Select the sections. For a portfolio tracker, the baseline set is: Account Information (with Account ID, Account Alias and Currency), Trades, Open Positions, Cash Transactions (this is where dividends, withholding tax, interest and fees live) and Corporate Actions. Portfolio Performance additionally asks for Sales Tax Details. Each section opens a field picker — selecting all fields is the forgiving choice; unused columns are ignored on import.
- Pick one level of detail in Trades. The Trades section can emit orders, executions and closed-lot rows. Keep exactly one — most importers expect execution-level rows. With two levels active, every trade appears at least twice in the file.
- General Configuration: set “Include Currency Rates?” to Yes — the one setting the Portfolio Performance manual singles out, because it lets the importer convert foreign-currency rows into your base currency. While there, choose an unambiguous date format (the ISO form
yyyy-MM-ddspares every downstream tool a guessing game). - Delivery Configuration: choose the format — XML, CSV, Text (Pipe) or Text (Tab) — and a default period from the presets: Last Business Day, Last Business Week, Last Month, Last Quarter, Last 30 Calendar Days, Last 365 Calendar Days, Last N Calendar Days, Month to Date, Quarter to Date or Year to Date.
- Save with Continue → Create. The query now has an ID and sits in your list.
- Run it. Click Run next to the query, confirm or override format and period — a custom date range is available at run time — and the file downloads. Multi-year histories mean one run per year; more on the limits below.
CSV or XML?
Both carry the same data; they serve different readers. CSV is for humans and spreadsheets — open it, filter it, sum a column. XML is for software: it nests each section explicitly, keeps field names unambiguous and never suffers from delimiter or decimal-separator confusion. The practical rule: if your destination documents a preferred format, use that — Portfolio Performance's IBKR importer, for instance, reads the XML output. If the destination is a spreadsheet or a generic CSV importer, export CSV. Nothing stops you from keeping one query and running it in either format; the format is chosen per run.
Date ranges and how far back you can go
The presets top out at Last 365 Calendar Days, and a custom range covers at most a comparable span per run — so a five-year history is not one export but a short series of them. The underlying data reaches back a documented distance: custom-date reports are available “for the four previous calendar years and from the start of the current calendar year”, monthly statements for the prior 60 months, annual statements for five previous years; anything older is a special request against a processing fee (IBKR statements documentation, retrieved July 2026). The working pattern for a first tracker import: run the query once per calendar year, oldest first, and import the files chronologically. After that, a single Year to Date or Last 30 Calendar Days run keeps things current.
The Activity Statement alternative
If you need a document rather than a data feed, the Activity Statement is the right door: Performance & Reports → Statements, period Daily, Monthly, Annually, Year to Date or Custom Date Range, output as an HTML view, PDF or CSV (How to Run a Statement, retrieved July 2026). It includes the readable performance summaries — mark-to-market, realized and unrealized figures, the cash report — and it is the document to archive or hand to an accountant.
Its CSV, however, is a different animal from a Flex CSV: one file stacking many sections, each with its own header rows and column layout. Spreadsheets and naive parsers trip over the changing structure mid-file. That is the practical reason trackers standardise on Flex Queries — a Flex file has one schema per section that you defined yourself. Use the Activity Statement for reading and record-keeping; use the Flex Query for feeding software.
Automating recurring exports
Because a Flex Query is saved server-side with an ID, it can be fetched without a login. The Flex Web Service is enabled from the same Flex Queries page (a gear icon opens the configuration and issues a token). Retrieval is a two-step HTTPS exchange: a request with token and query ID returns a reference code, and a second call collects the finished statement — typically a few seconds to half a minute later. Several portfolio tools use exactly this mechanism for scheduled nightly imports: you paste the token and the query ID once, and the tracker pulls the file itself. Treat the token like a password. It grants read access to reporting data only, but reporting data is your entire financial history.
The quirks worth knowing in advance
Three properties of IBKR exports surprise people on first import — none is a bug, all three reward knowing about them beforehand:
- Multi-currency rows. An international account produces rows in many currencies, and the file does not convert them for you — each row carries its own currency code, and cash is reported per currency. With “Include Currency Rates?” set to Yes, the file also carries the conversion rates, and a competent importer builds base-currency figures from them. Without it, expect a tracker to either refuse the rows or mis-state totals.
- Dividends live in Cash Transactions — and accruals are not payments. A paid dividend arrives as a cash-transaction row, with the withholding tax as its own separate row. Accrual sections such as Change in Dividend Accruals describe announced-but-unpaid amounts; a tool that imports accruals alongside cash rows double-counts income. Feed trackers from Cash Transactions and check one year's dividend total against an Activity Statement after the first import.
- Corporate actions are their own section. Splits, mergers, spin-offs and symbol changes appear under Corporate Actions rather than as trades. Importers that skip the section leave your tracker's share counts drifting away from reality. After any corporate action in a position, compare quantities between tracker and Client Portal before trusting the numbers again.
Troubleshooting the export
| Symptom | Cause | What resolves it |
|---|---|---|
| Dividends missing after import | The query has no Cash Transactions section — dividend and withholding-tax rows live there. | Edit the query, add Cash Transactions, re-run and re-import. |
| Dividend totals too high | Accrual rows ("Change in Dividend Accruals") were imported alongside the paid rows. | Import Cash Transactions only; leave accrual sections out of the tracker feed. |
| Every trade appears two or three times | The Trades section is emitting more than one level of detail (orders and executions). | Keep exactly one level of detail — most importers expect executions. |
| Position quantities drift over time | Splits, mergers or spin-offs sit in the Corporate Actions section, which many tools skip. | After any corporate action, compare tracker quantities against Client Portal and adjust. |
| Non-EUR/USD rows confuse the tracker | Each row carries its own currency; the file has no converted totals unless requested. | Set "Include Currency Rates?" to Yes so tools can convert into your base currency. |
| History stops after one year | A single run covers at most the longest preset (Last 365 Calendar Days) or one custom range. | Run the query once per calendar year — data reaches back four previous calendar years. |
What to do with the file
The export is a means, not an end: rows become useful when a portfolio tool turns them into cost basis, dividend history, fee totals and a time-weighted return. The generic recipe works for any tracker. Import the per-year files chronologically; reconcile one completed year's dividend total and today's position quantities against Client Portal; then switch to periodic incremental runs. If your tool imports holdings rather than transactions, the Open Positions section already carries what a holdings template needs — Acutic's CSV portfolio import works from exactly that trio of symbol, share count and average cost. What the analysis layer does with an imported portfolio afterwards is described on the features page.
One habit carries the whole workflow: keep the original export files unmodified, and if you want to inspect one, work on a copy. Spreadsheet applications rewrite encodings, dates and decimal separators on save — and an original you still have is an import you can always redo from scratch.
Further reading: Trade Republic CSV export: the 2026 guide — the same job on a broker that only just shipped its export — and Scalable Capital: exporting the Depot as CSV — the German-broker counterpart to this guide. Create free account.
Acutic provides investment research and educational analysis under MAR Art. 20 / § 85 WpHG. Acutic does not provide investment advice (Anlageberatung per § 1 Abs. 1a S. 2 Nr. 1a KWG / Art. 4(1)(4) MiFID II), portfolio management, or any other licensed investment service. No content in this article constitutes a personal recommendation.