Skip to content

Interactive Brokers: connect through Flex Queries

Trader, Pro and Fleet plans.

Interactive Brokers gives other applications no live read-only access, but it publishes your statements through its Flex Web Service: a token and the Flex Queries you make in the Client Portal. TakeJournal asks for them on its own, read-only: stocks, options on stocks, futures and options on futures, with their commissions, expiries, exercises and assignments, and the deposits and withdrawals. It never places an order and cannot.

  1. Performance & Reports → Flex Queries. Create a Trade Confirmation Flex Query: the section Trade Confirmation with Executions ticked and every field selected, the format XML, the period Today. Save it and note its Query ID.
  2. Optional, for the history and the money moved: an Activity Flex Query with the sections Trades (Executions, every field), Cash Transactions, Corporate Actions and Account Information, the format XML, the period Last 365 Calendar Days. Note its Query ID too.
  3. On the same page, Flex Web Service Configuration: switch the service on and generate a token. Choose the longest validity IB offers (up to a year) and leave the IP restriction empty: TakeJournal’s server asks from its own address.

Connections → Add connection, type Interactive Brokers (Flex Web Service):

  • Flex Web Service token — the token from step 3. It is stored encrypted and used for nothing but reading; delete the connection and it goes with it.
  • Trade Confirmation query ID — the ID from step 1.
  • Activity query ID — the ID from step 2, or empty.

The accounts come with the first sync, named by the alias you gave them at IB and in IB’s base currency.

IB says its Flex Web Service is not for asking every minute, and its statements are not live: an execution is in the Trade Confirmation statement 5 to 10 minutes after the fill, and the Activity statement is updated once a day after the close. So the automatic sync (on Fleet, while TakeJournal is open) asks every 30 minutes on a weekday from 9:00 to 17:30 New York time, once after that, and once a day at the weekend; the Activity query at most once in 20 hours. Sync now on the dashboard or the Connections page asks at once.

An import of a Flex Query file and the connection know the same executions by IB’s execution IDs, so a file of older trades never doubles what the sync brought.

The Activity statement’s Corporate Actions bring a stock’s splits, symbol changes and stock dividends (splits); the other corporate actions, a merger or a spin-off, are not counted.

When IB refuses, the connection’s card says why and what to do: an expired token (make a new one and enter it in the connection), a token limited to other IP addresses, a query that is not the token’s, or a statement IB has not finished yet (the next sync reads it).

With the section Open Positions (every field) in the Activity query, the sync that reads it compares the positions it lists with your fills, so a close the history lacks is found (A missing close); a difference in shares no missing close explains (shares transferred in from another broker) raises no warning.

Interactive Brokers: import a Flex Query · Import reports · Brokers and imports