Guide · about 5 minutes

Sync your Interactive Brokers trades automatically

Set it up once: create a Flex Query and a token in IBKR, paste them into Market Matrix, and your trades come in every hour. No more file exports.

  1. Open Flex Queries

    Log in to IBKR’s Client Portal. In the top menu choose Performance & Reports, then Flex Queries. Next to Activity Flex Query, click the +.

  2. Name the query and open Trades

    Type a name such as Market Matrix in Query Name. Under Sections, click Trades.

  3. Tick Executions and select every field

    In the Trades window, tick Executions under Options. Click Select All under the list of fields, then click Save.

  4. Add Open Positions, for swing trades

    Still under Sections, click Open Positions. Tick Summary under Options, click Select All, then Save. Market Matrix then shows the trades you’re still in, with IBKR’s latest price and unrealized P&L.

  5. Choose XML and the last 365 days

    Scroll down. Under Delivery Configuration choose Format XML and Period Last 365 Calendar Days. Leave General Configuration as it is (date yyyyMMdd, time HHmmss, separator semicolon). Click Continue.

  6. Create the query

    IBKR shows a summary of your query. Click Create. You’re back on the Flex Queries page with the new query in the list.

  7. Copy the Query ID

    Click the ⓘ next to your new query. Write down the Query ID, a number of about 7 digits.

  8. Generate a token

    On the right of the Flex Queries page, click the gear next to Flex Web Service Configuration. Turn the service on if it’s off, click Generate New Token and pick the longest expiry. Copy the token and keep it private, like a password.

  9. Connect in Market Matrix

    In Market Matrix open Accounts → Add account → Interactive Brokers → Live sync. Paste the token, type the Query ID and click Connect.

  10. Pick your accounts

    IBKR takes a few minutes to build your first report. When it’s ready your IBKR account numbers appear: tick the ones to add, choose how far back to import and click Start tracking. Market Matrix then checks IBKR every hour for new trades.

Something not working?

IBKR says the query name already exists

You made a query with that name before. Use another name, such as Market Matrix 2.

Market Matrix says the report has no trades yet

The report only covers the last 365 days, and IBKR doesn’t build reports for an account that hasn’t been funded yet. Check that the query has the Trades section with Executions ticked, then click Ask IBKR again.

Market Matrix says IBKR turned down the token

Tokens expire. Generate a new one (step 8) and connect again with it.

A trade I made today isn’t showing

IBKR adds each day’s trades to this report after the market closes, so they show up the next day. A trade you’re still in shows under Open positions on Home, and becomes a trade in your journal once it’s fully closed.

IBKR is taking a long time

The first report can take a few minutes, and longer on weekends while IBKR does maintenance. You can close the window: your accounts will be there when you come back.

Is it safe?

The token can only download your reports. It can’t place trades or move money. Market Matrix stores it encrypted, and you can disconnect any time from Accounts.

Still stuck? Write to us and we’ll help