Guide / Interactive Brokers
How to export your Interactive Brokers history.
Interactive Brokers does not give you one big history file. It gives you something more useful: a Flex Query, a saved report you design once and a tracker can then fetch whenever it needs to, with a token that lets it do so. Setting it up takes about ten minutes. This guide walks through it, says which settings matter, and explains how to bring in more than a year of history.
The short version
Include five sections with all their fields: Trades, Cash Transactions, Open Positions, Transfers and Corporate Actions. Set the format to XML, save, and note the Query ID.
Turn the service on and generate a token with the longest expiry offered. Copy the token and note its expiry date.
Step 1: create the Activity Flex Query
- Open Flex Queries. In IBKR's Client Portal, go to Performance & Reports, then Flex Queries (in the newer menu: Menu → Reporting → Flex Queries).
- Create a new Activity Flex Query with the + in the Activity Flex Query panel, and give it a name, such as “Parallax”.
- Add the five sections below. Each section opens a list of fields when you select it. Tick all of them: a field left unticked is simply missing from the report, and nothing warns you.
- Set the format to XML. CSV and text are for reading; XML is what a tracker parses.
- Leave the date and time formats at their defaults (year first, such as
20260924;153000). A day-first format is easy to misread for the first twelve days of every month. - Choose your account only. If you have several IBKR accounts, make one query per account.
- Set the period to Last 365 Calendar Days. A tracker that asks for specific dates overrides it, but it is the widest period a single report can cover.
- Save, and note the Query ID shown with the query's details in the Activity Flex Query list.
| Section | Why it is needed |
|---|---|
| Trades | Every buy and sell, and currency conversions. Without it there is no history at all. |
| Cash Transactions | Dividends, withholding tax, fees, interest, deposits and withdrawals. Without it, returns cannot be separated from money you added. |
| Open Positions | What IBKR says you hold today, so the rebuilt history can be checked against it. |
| Transfers | Shares that arrived without being bought: moved in from another broker, or granted. |
| Corporate Actions | Splits, mergers and spin-offs, which change how many shares you hold. |
In the Trades section, the individual executions are what matter. If IBKR offers summary options such as Symbol Summary or Asset Class Summary, they are not needed; a tracker that counts summary rows as trades double-counts every position.
Step 2: enable the Flex Web Service and generate a token
- Open Flex Web Service Configuration from the gear icon on the Flex Queries page.
- Turn the service on and save.
- Choose how long the token lasts. Pick the longest period offered. When it expires, the tracker stops receiving updates until you generate a new one.
- Leave the IP address blank, unless you are entering the tracker's own server address. The token is used by the tracker's server, not your computer.
- Generate the token and copy it. It is a long run of digits. Note the expiry date as well.
The token can only fetch the Flex reports you have defined, which are statements of what already happened. It cannot place orders or move money. Generating a new token invalidates the old one, which is also how you revoke access.
Bringing in more than a year
One Flex report covers at most 365 days. For a longer history, fetch it in yearly windows:
- Start with the oldest year and work forward, one window after another, with no gaps between them. A tracker that builds your positions year by year needs each year's starting point before it can read the next one.
- Expect old years to be slow. IBKR generates reports on request, and a window a few years back can take far longer than a recent one, and sometimes it never finishes. If that happens, try again later, or start that window a little later.
- Reports stop at yesterday. IBKR produces activity statements at the end of each trading day, so today's trades appear tomorrow.
What is inside the report
The XML has one element per section, and one row per event with the fields you ticked. The ones that decide whether the numbers come out right:
| Field | What it does |
|---|---|
tradeID, transactionID | Identify each trade and cash movement, so fetching the same day twice does not count it twice. |
assetCategory | Tells a share (STK) from a currency conversion (CASH). Without it, an FX conversion looks like buying a stock called “EUR.USD”. |
levelOfDetail | Tells an execution from a summary row. |
netCash, ibCommission, taxes | What the trade actually cost, as IBKR booked it. |
fxRateToBase | The rate IBKR used to convert into your account's base currency. |
isin | The instrument's identity, which a ticker alone is not. |
type (Cash Transactions) | Dividend, withholding tax, fee, interest, deposit or withdrawal: the whole classification. |
position, costBasisMoney (Open Positions) | The shares and cost IBKR reports, to reconcile against. |
Common problems
“Statement is not available”
The report was asked to end today. It has to end yesterday or earlier.
“Statement generation in progress”, for a long time
Normal for an old window. Try again later, or start the window a little later.
The report covers more than one account
Edit the query and choose a single account, or make one query per account.
Positions are double what IBKR shows
Summary rows are being counted as trades. Keep only executions, or use a tracker that skips summaries.
The token was refused
It expired, was replaced by a newer one, or is restricted to an IP address that is not the tracker's. Generate a new one. The Query ID stays the same.
Using it in Parallax
Paste the token and the Query ID into Parallax. Before saving anything, Parallax runs your query once and checks that every section and field it needs is there; if one is missing, it lists them, so you can fix the query rather than discover it in the numbers later. Enter the token's expiry date too, and Parallax warns you when it is a month away.
Then choose where the history should start. Parallax fetches one window of up to 365 days at a time, so for a longer history start with the oldest year and import each following year in turn. After that, it keeps the account current by itself, fetching up to twice a day from where the last fetch ended. Trades are matched on IBKR's own IDs, so a day fetched twice is not counted twice. The token is stored encrypted and is never shown back to the browser.
Then it rebuilds the history into snapshots and shows whether each move beat keeping what you had. The details are on the coverage page; how moves and returns are measured is on the methodology page.
Parallax Investing is not affiliated with or endorsed by Interactive Brokers. Interactive Brokers and IBKR are trademarks of their owner. These steps were checked against IBKR's guides in September 2026 and can change without notice. This guide is for information and is not investment or tax advice.