Interactive Brokers setup guide
Configure an IBKR Activity Flex Query
Compounding Wealth imports Interactive Brokers activity through Flex reports. You need two values from IBKR: a Flex report ID and a Flex token.
Fastest: let your AI agent set it up
On your phone or computer, ChatGPT can do it in its own browser. You sign in to Interactive Brokers there when it asks, and it does the rest.
ChatGPT can see the IBKR pages it opens, including the Flex token it generates.
If you use an AI agent that can control your browser, such as Claude or Codex, sign in to Interactive Brokers in that browser and give the agent this prompt:
Set up my Interactive Brokers Flex report for Compounding Wealth by following https://compounding-wealth.com/guides/ibkr-flex-config/agent.mdThe agent creates the Flex Query, checks that Flex Web Service is enabled, and helps you generate a token. It gives you the Flex report ID; you copy the token from the IBKR page yourself. Paste both into Compounding Wealth's Add IBKR Flex Report form.
Step 1Create the Activity Flex QueryConfigure the IBKR Activity Flex Query that Compounding Wealth reads.
Target configuration
Create an Activity Flex Query, choose XML, set the period to Last 365 Calendar Days, select all fields in the required sections, and include every account you want to track. Do not share your account numbers or the generated query ID in support messages.
Before you start
- Log in to Interactive Brokers Account Management.
- Open Performance & Reports, then Flex Queries.
- Choose any query name that will help you recognize this report later.
Required sections
Select all fields in every section. For sections that show options, enable the options listed here before selecting all fields.
| Section | Options to enable |
|---|---|
| CFD Charges | None |
| Cash Report | Currency Breakout |
| Cash Transactions | Already ticked when the section opens: every transaction type and Detail. Leave them as they are (see screenshot). |
| Change in Dividend Accruals | Detail |
| Commission Details | None |
| Corporate Actions | SummaryDetail |
| Financial Instrument Information | None |
| Forex Balances | Summary |
| Forex P/L Details | Transaction |
| Incoming/Outgoing Trade Transfers | Trade Transfers |
| Interest Accruals | None |
| Open Dividend Accruals | None |
| Open Positions | Summary |
| Statement of Funds | Currency BreakoutInclude Starting and Ending Balances |
| Trades | OrderExecution |
| Transaction Fees | SummaryDetailExecution |
| Transfers | Transfer |
Delivery configuration
- Accounts
- Select every account you want to track.
- Models
- Leave as Optional.
- Format
- XML
- Period
- Last 365 Calendar Days
General configuration
- Date Format
- yyyy-MM-dd
- Time Format
- HH:mm:ss TimeZone
- Date/Time Separator
' 'single space- Profit and Loss
- Default
- Include Offsetting Trade/Cancel Pairs?
- No
- Include Currency Rates?
- Yes
- Include Audit Trail Fields?
- No
- Display Account Alias in Place of Account ID?
- No
- Breakout by Day?
- No
Step-by-step guide
Open the Flex Queries page
Confirm the page heading is Flex Queries.

Create an Activity Flex Query
In the Activity Flex Query panel, click the + create button.

Name the query
Enter any name that will help you recognize the report later.

Configure the required sections
For every section in the table above, open the section, enable the listed options, click Select All for fields, then click the section modal's Save button. After saving, the section tile should appear selected before you move on.

Select options before selecting all fields
Some sections have options above the fields table. Set those first, then use Select All. For example, Cash Report uses Currency Breakout.
Some sections already have the right options ticked when they open. Cash Transactions comes with every transaction type and Detail selected, so only tick Select All and click Save.

Set delivery and general configuration
In Delivery Configuration, use Add/Edit Account(s) to select every account you want to track. Set Format to XML and Period to Last 365 Calendar Days. Then set the general configuration values listed above.

Review the query
Click the main form Continue button. Confirm the query name, selected sections, delivery settings, and general settings. The final button is labeled Create.

Create the query
Click Create. IBKR will confirm the custom Flex Query was saved; click Ok to return to the Flex Queries page. When the query appears on the Flex Queries page, copy its Query ID. Compounding Wealth calls this the Flex report ID; keep it with the token you generate in Step 3.

Step 2Confirm Flex Web Service is enabledMake sure IBKR allows Flex reports to be fetched by the app.
Return to the Flex Queries page and confirm Flex Web Service Status shows Enabled. Compounding Wealth needs that web service access to read the Flex report.

Step 3Generate the Flex Web Service tokenCreate the token that Compounding Wealth will use to fetch your Flex Query.
Open Configure Flex Web Service. If Flex Web Service Status is not already checked, check it and click Save.

In the Generate New Token section, set Expire After to 1 Year, leave Valid for IP Address blank, click Generate New Token, and then click Save.

IBKR will show the generated token after saving. Write it down or copy it into your password manager immediately, alongside the Flex report ID from Step 1; you will need both when connecting Compounding Wealth. Do not share either value in support messages.