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.

Finish setting up with your AI app

It opens with everything filled in. Send the message, sign in to IBKR when asked, and the app shows your report once it's done.

Set up with ChatGPT Set up with Claude

Needs the ChatGPT or Claude desktop app.

Run the chat on your computer

ChatGPT starts new chats in the cloud, where your IBKR passkey won't work. Before you send the message, click the button next to it and choose On your computer.

ChatGPT's “Where should this chat run?” menu, opened from the button beside the message box, with “On your computer” selected.

Open ChatGPT

Fastest: let your AI agent set it up

On a computer, ChatGPT or Claude can do it in your own browser, through its desktop app and browser extension. On a phone, ChatGPT does it in a cloud browser. You sign in to Interactive Brokers when it asks, and it does the rest.

For the smoothest setup, start from the Compounding Wealth app: open Add IBKR Flex Report and choose ChatGPT or Claude. The agent then gets a one-time setup link and hands the Flex token and report ID straight to the app, so you don't copy anything. The buttons below start the same setup without that link; at the end you paste both values into the app yourself.

Set up with ChatGPT Set up with Claude

Other agent

If you use another AI agent that can control your browser, 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.md

You have my permission to create the Flex Query, enable Flex Web Service and generate a one-year Flex token without asking me first, unless the instructions say to check with me.

The 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 1 Create the Activity Flex Query Configure 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 Summary Detail
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 Breakout Include Starting and Ending Balances
Trades Order Execution
Transaction Fees Summary Detail Execution
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

  1. Open the Flex Queries page

    Confirm the page heading is Flex Queries.

    Interactive Brokers Flex Queries page
  2. Create an Activity Flex Query

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

    Activity Flex Query create button
  3. Name the query

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

    Create an Activity Flex Query form
  4. 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.

    Cash Report section with Currency Breakout enabled and Select All checked
  5. 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.

    Cash Transactions section with all transaction types and Detail already ticked, and Select All checked
  6. 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.

    Delivery Configuration controls showing accounts, models, XML format, and Last 365 Calendar Days
  7. 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.

    Bottom of the review page with the Create button
  8. 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.

    IBKR confirmation that the Flex Query was saved
Step 2 Confirm Flex Web Service is enabled Make 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.

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

    IBKR Flex Web Service status checked before saving
  2. 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 Flex Web Service token form with one year expiry selected

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.