Interactive Brokers Trade Export: Flex Queries for Journaling

Quick answer

A Flex Query is a customizable report in Interactive Brokers' Client Portal. For a journal, create an Activity Flex Query (or a Trade Confirmation Flex Query), include the Trades section with Executions and all fields, choose CSV, an unambiguous date format and a custom date range, then run it. Download limits can cap each run at 365 days, so export long histories in yearly pieces.

Key takeaways
  • Interactive Brokers offers two Flex Query types: Activity Flex Query and Trade Confirmation Flex Query; both are created under Flex Queries in Performance and Reports.
  • For a trade journal, include the Trades section, choose Executions, and select all fields so nothing is missing.
  • Use an unambiguous date format such as yyyy-MM-dd or yyyyMMdd; a day-first dd/MM/yyyy format is reported to break parsers.
  • One guide states IBKR allows only 365 days per query, so run one query per year for long histories.
  • Menu labels and limits can change, so confirm each setting in your own Client Portal.
In this article
  1. What is a Flex Query, and which type should you pick?
  2. How do I create a Flex Query for a journal, step by step?
  3. Which fields should you include?
  4. Worked example: executions become a trade
  5. What are the date and format settings to use?
  6. How far back can you export?
  7. Should you automate with the Flex Web Service?
  8. How do you check the file before you import it?
  9. What mistakes break an IBKR journal import?
  10. The short version

An Interactive Brokers Flex Query is a report you design yourself in the Client Portal: you pick the sections, the fields, the date format and the output format, then run it and download the file. For journaling, the recipe is short. Create a query with the Trades section, choose Executions, select every field, set the output to CSV and the dates to an unambiguous format, and run it over a custom range.

Interactive Brokers is more powerful than most retail platforms and also less forgiving, because its default reports are built for accounting, not for reviewing trades. This guide explains what Flex Queries are, which type to pick, which fields matter, a worked example with stocks and futures, and the mistakes that corrupt a journal import. Interactive Brokers’ public documentation was partly blocked to my automated reader, so I mark clearly what comes from IBKR’s own page and what comes from third-party import guides.

What is a Flex Query, and which type should you pick?

Interactive Brokers’ developer documentation says you must “generate at least one Activity Flex Query or Trade Confirmation Flex Query,” and that you read the Query ID from the info pop-over for use when generating a report. So there are two types, and both live on the Flex Queries page.

Query type Built from Typical use
Activity Flex Query Account statement style sections: Trades, Open Positions, Cash Transactions and more A full record, including cash and fees
Trade Confirmation Flex Query Executions A focused execution list

Third-party guides use both. A Sharesight help page walks through an Activity Flex Query, while a TraderFyles guide uses a Trade Confirmation Flex Query. Both end with Trades or Executions selected. IBKR’s developer documentation is reported to say that Activity data refreshes once daily at close while Trade Confirmation data updates through the day, but I could not open that page to confirm it, so check it if the timing matters to you. If your journal’s help page names a type, use that one.

How do I create a Flex Query for a journal, step by step?

Open the Flex Queries page, add a new query, choose the Trades section with Executions, select all fields, set the general options and save. The sequence below merges the two third-party guides above; labels such as “Reports” or “Performance and Statements” differ between guides, so follow the menu you see.

  1. Log in to Client Portal and open Performance and Reports (some guides call it Reports or Performance and Statements), then Flex Queries.
  2. Click + beside Activity Flex Query (or beside Trade Confirmation Flex Query).
  3. Name the query, for example “Journal export.”
  4. Under Sections, select Trades. In the pop-up choose Executions and tick Select All. Save.
  5. Under general configuration, set the date format, time format and date/time separator (more on these below).
  6. Click Continue, review, then Create.
  7. Back on the list, click the run arrow, set Period to a custom date range and Format to CSV, then run and download.

Opening the query’s info icon shows the Query ID. You only need it if you later use the Flex Web Service, which retrieves the same report programmatically with a token.

Which fields should you include?

Select all fields in Executions and then check that the essentials are present. One third-party setup note lists these Trades fields: transactionID, tradeID, dateTime, quantity, tradePrice, proceeds, ibCommission and fifoPnlRealized (ib-flex setup notes). Field names can differ slightly between the Flex UI and an importer’s expectations.

Field Why a journal needs it
dateTime Entry and exit timing, session analysis
symbol Grouping by instrument
quantity Size, and side by sign
tradePrice Entry and exit prices
ibCommission Real cost of trading
fifoPnlRealized Realized profit or loss per execution
tradeID / transactionID De-duplicating rows
multiplier (instrument information) Needed for futures and options to turn points into money

If you trade futures or options, also include the instrument information that carries the multiplier, expiry and strike; without the multiplier a journal cannot convert price points to dollars.

Worked example: executions become a trade

Hypothetical numbers. You buy 100 shares at 50.00 and sell them at 51.20, paying 1.00 commission on each execution.

Execution Quantity Price Commission
Buy +100 50.00 -1.00
Sell -100 51.20 -1.00

Gross: (51.20 - 50.00) × 100 = 120.00. Net: 120.00 - 2.00 = 118.00. The Flex file shows two rows, and a journal that counts rows as trades would see two. The importer must pair them into one round trip.

Now a futures example. You buy 1 contract at 4,500.00 and sell at 4,504.00 on an index future with a 50-dollar multiplier. Move: 4 points × 50 = 200.00 per contract. Without the multiplier column, the file shows prices 4,500 and 4,504, and a naive profit of 4 or 4 × quantity. That is a 50-fold error, and it is why instrument fields matter. If you want the broader futures picture, see the futures trading journal guide.

What are the date and format settings to use?

Use an ISO-style date format, CSV output, and a consistent separator. The settings you pick decide whether the import works.

Setting Recommended Why
Date format yyyy-MM-dd or yyyyMMdd Unambiguous and sortable
Time format HH:mm:ss or HHmmss Clear and consistent
Date/time separator Semicolon (default) Does not clash with commas in CSV
Output format CSV, with headers Opens in a spreadsheet
Period Custom date range Covers the history you need

Sources disagree on date format. The Sharesight guide sets mm/dd/yyyy, TraderFyles shows yyyyMMdd as default, and the ib-flex notes call yyyy-MM-dd and yyyyMMdd recommended and say dd/MM/yyyy is not supported and causes parsing errors. That is one tool’s parser, but the lesson is general: a day-first or month-first date is ambiguous on 3 June versus 6 March. Pick the format your importer’s help page names, and if it names none, use yyyy-MM-dd.

The ib-flex notes say their own parser accepts XML only and not CSV or text. That is one tool’s limit, not IBKR’s, so choose the output format your journal’s help page asks for. The two import guides above both use CSV.

How far back can you export?

Sharesight’s guide states that IBKR allows only 365 days per query or download. Treat that as a limit to plan around even if your account behaves differently.

Hypothetical plan for a trader who started in March 2023 and now has records through November 2026. Run one query for each full calendar year, then one year-to-date:

Run Period
1 01 Jan 2023 to 31 Dec 2023
2 01 Jan 2024 to 31 Dec 2024
3 01 Jan 2025 to 31 Dec 2025
4 Year to date 2026

Keep four files, named by period. When you import, check that no execution appears in two files. Overlapping ranges are an easy way to double count, and the CSV import errors guide shows how to find duplicates by trade ID.

Should you automate with the Flex Web Service?

Not at first. The Flex Web Service retrieves the same Flex reports through a token and the Query ID, which suits scripts and scheduled jobs. IBKR’s documentation describes capturing the Query ID from the info pop-over and says the service uses a token you create in the Client Portal. For a human journaling a few hundred trades a year, a monthly manual run is simpler and easier to check.

Automate when the manual run becomes the weak link: you forget it, or the volume makes hand checking impractical. Even then, keep the downloaded files. A token is a credential, so apply the same care as with any API key: limit who sees it, set the shortest lifespan the screen allows and revoke it when the script is retired.

Situation Better choice
Under a few hundred trades a year Manual Flex run each month
Daily review of futures day trades Scheduled retrieval, plus a monthly manual cross-check
Building your own analysis tool Flex Web Service with a token
Moving to a new journal One-off CSV by year

How do you check the file before you import it?

Check five things in two minutes. First, the header row contains dateTime, quantity, tradePrice and ibCommission. Second, the first and last dates match the range you ran. Third, the number of rows is plausible: each round trip needs at least two executions, so 40 round trips means at least 80 rows. Fourth, sum fifoPnlRealized and compare it with the realized total in your statement for the same dates, allowing for commissions treated separately. Fifth, look for repeated tradeID values, which mean duplicates.

If the numbers disagree, narrow it down by month, then by week, then by day, until you find the missing or doubled execution. This is slower than it sounds the first time and quick once you have done it twice, and it protects every statistic your journal later computes, from win rate to expectancy.

What mistakes break an IBKR journal import?

Five mistakes cause most failures, and each is easy to avoid.

  • Selecting only some fields. Ticking Select All avoids missing columns.
  • Ambiguous dates. Use yyyy-MM-dd.
  • Wrong section. Trades and Executions, not Open Positions.
  • The wrong account. If you hold more than one account, open each file and confirm it holds the account you meant before you import it.
  • Mixed time zones. Flex times carry no obvious zone label in the guides I read, so compare one fill with your own record.

When you compare tools for IBKR support, the best trading journal software guide lists what each verified vendor says about imports, and the spreadsheet versus software comparison covers the time cost of doing this by hand. Pips Decoded recognizes Interactive Brokers CSV layouts; see pipsdecoded.com for the current list.

This article is educational and is not financial advice.

The short version

  • Flex Queries live under Performance and Reports; create an Activity or Trade Confirmation query with Trades, Executions, Select All.
  • Set CSV output, an ISO-style date format and a custom period, then run and download.
  • One guide says IBKR caps each run at 365 days, so export per year and avoid overlapping ranges.
  • Include instrument fields such as the multiplier for futures and options, or profit will be wrong by the multiplier.
  • Menu names differ by guide and region; confirm in your own Client Portal.

Sources

Frequently asked questions

What is an Interactive Brokers Flex Query?

A Flex Query is a customizable report you define in the Client Portal. You choose sections, fields, date and time formats and an output format, then run it on demand or fetch it through the Flex Web Service. IBKR's developer documentation refers to generating at least one Activity Flex Query or Trade Confirmation Flex Query.

What is the difference between an Activity Flex Query and a Trade Confirmation Flex Query?

Both are query types in the same Flex Queries page. An Activity Flex Query is built from account statement sections such as Trades, Open Positions and Cash Transactions. A Trade Confirmation Flex Query focuses on executions. Journals can use either, so check which one your importer or tool asks for before building it.

How do I export IBKR trades to CSV?

In Client Portal, open Performance and Reports, then Flex Queries, create a query with the Trades section and Executions fields, save it, and run it. In the run window choose a date period and set Format to CSV, then download the file. Menu labels vary by account and region.

How far back can I export from Interactive Brokers?

One published import guide says IBKR allows only 365 days per query or download, so older history needs separate runs by year. Other limits may apply to your account, and the system may change over time. Run one query per year and keep each file rather than relying on a single run.

Why does my IBKR CSV import fail on dates?

Date format is the usual cause. A parsing guide reports that dd/MM/yyyy is unsupported and causes errors, while yyyy-MM-dd and yyyyMMdd are recommended. Set the Flex Query's date format to an unambiguous ISO-style option and keep the date and time separator consistent with what your importer expects.

Keep reading

Written by the Pips Decoded editorial team and last updated November 13, 2026. We cite the sources we opened and recompute every example. Pips Decoded sells a trading journal, so read our product mentions with that in mind. How we write and check articles. This article is educational and is not financial advice.