Guide
How to Set Up an IBKR Flex Query for a Trading Journal
Create an Interactive Brokers Activity Flex Query with the right trade fields, set CSV delivery, and generate a read-only Flex Web Service token.
To get your Interactive Brokers trades into a journal, create an Activity Flex Query in the client portal under Performance & Reports → Flex Queries, tick the Trades section with execution-level fields, set the delivery format to CSV, and save it. You can then run it and download the file, or turn on the Flex Web Service, generate a token and give the token and the query's ID to your journal, which fetches the report for you. The token can only read reports; it can't trade or move money.
What is a Flex Query?
A Flex Query is a report template you build once in IBKR's portal: you choose the sections, the fields and the format. Each time it runs, IBKR fills it with up-to-date data. That makes it a reliable way to get every execution, with commissions, in a consistent layout.
There are two ways to use it:
- As a file: run the query in the portal, download the CSV, and import it.
- As a feed: turn on the Flex Web Service, and a journal uses a token plus the query ID to fetch the report on a schedule.
How to create an Activity Flex Query (step by step)
Menu names in IBKR's portal change from time to time. These steps match the layout in October 2026; if yours differs, check IBKR's help pages for Flex Queries.
- Log in to the client portal and open Performance & Reports → Flex Queries.
- Create a new Activity Flex Query (the + beside Activity Flex Query) and give it a name such as "Journal trades".
- Sections: tick Trades, and choose the Executions level of detail.
- Select these fields: Account ID, Symbol, Date/Time, Buy/Sell, Quantity, Trade Price, IB Commission, Multiplier, Trade ID and Open/Close Indicator. You can tick more, but these are the ones a journal needs.
- Delivery configuration:
- Format: CSV
- Include header and trailer records: No
- Include column headers: Yes
- Include section code and line descriptor: No
- Period: Last 365 Calendar Days
- General configuration:
- Date format: yyyyMMdd
- Time format: HHmmss
- Date/time separator: ; (semicolon)
- Save the query and note the Query ID shown next to it in the list.
Why these fields matter
- Multiplier turns a price move into money. For futures it's the point value, so without it a journal can't work out P&L.
- Open/Close Indicator tells the journal whether each execution opened or closed a position. That matters when a report starts while you were already in a trade.
- Trade ID lets a journal recognise executions it already has, so running the report again doesn't create duplicates.
- IB Commission is written as a negative number, as a cost.
Some tools that read Flex reports don't support day-first dates (dd/MM), which is one reason to use yyyyMMdd: it can't be misread.
Option 1: download the file
On the Flex Queries page, run the query, choose CSV if asked, and download the report. Import that file into your journal like any other export. Repeat whenever you want to bring in new trades.
Option 2: turn on the Flex Web Service
- On the Flex Queries page, open Flex Web Service Configuration (the gear beside Flex Web Service).
- Enable it.
- Generate a new token. Choose how long it lasts: from 6 hours up to a year.
- Optionally restrict it to an IP address. Leave it blank if your journal fetches from servers you don't control.
- Copy the token straight away and store it somewhere safe.
- Give the token and the Query ID to your journal.
A few things to know:
- The token is read-only. It fetches the reports you've built. It can't place trades, move money or change your account.
- Generating a new token invalidates the old one. If you regenerate it, update every tool that uses it.
- It expires. When it does, the feed stops until you generate a new one.
- Queries belong to the username that created them. If you have several IBKR usernames, create the query with the one you'll keep using.
- IBKR rate-limits requests (one a second and ten a minute per token), so journals fetch on a schedule rather than continuously.
Marble connects this way. You paste the Query ID and the token under Connections, choose which IBKR account goes into which Marble account, and the first sync brings in the last 90 days. The token is stored encrypted and only Marble's server can use it.
Time zone and dates
Flex reports write times without a zone. They follow your account's reporting time zone, which is often US Eastern. Check one trade you remember against the report, and set the same zone in your journal.
Futures in IBKR reports
For futures, a few fields are worth checking once:
- Symbol may include the contract month (for example
MESZ6), depending on the fields you pick. A journal should group months under one market. - Multiplier is the dollars per point, for example 5 for MES and 20 for NQ.
- Quantity may be negative for sells. With Buy/Sell included, a journal can read the side from that instead.
Once trades are in, add your initial stop to each, so the journal can work out R multiples. If you'd rather keep a spreadsheet, the same fields map onto the columns in our trading journal spreadsheet template.
Troubleshooting
- "Token has expired". Generate a new token and update your journal.
- The report is empty. Check the query's period and that the right account is ticked in the delivery settings.
- Duplicate trades. Trade ID wasn't in the query. Add it, then remove the duplicate import.
- Positions look reversed. Open/Close Indicator is missing, so a closing execution from before the report's start was read as an opening one. Add the field.
- Wrong P&L on futures. Multiplier is missing.
UK trader using IBKR for futures? See what UK futures traders need from a journal.
Marble syncs Interactive Brokers through a read-only Flex token, or imports the same report as a file. Connect it in Marble.
Interactive Brokers is a trademark of its owner. Marble isn't affiliated with or endorsed by Interactive Brokers.
Marble is a trading journal. Nothing here is financial advice.
Questions
Can a Flex token place trades?
No. The Flex Web Service only delivers reports you've set up. A token can fetch those reports, but it can't trade, move money or change your account.
How long does a Flex Web Service token last?
You choose when you generate it, from 6 hours up to a year. Generating a new token invalidates the old one, so update any tool that uses it.
Why can't I see a Flex Query I created?
Flex Queries belong to the username that created them. Log in to the portal with that same username to see or edit them.