Connect Interactive Brokers

How to create the Activity Flex Query and Flex Web Service token Viktury reads your IBKR account with, and what it imports.

  • Interactive BrokersAutomatic read-only sync

Interactive Brokers connects to Viktury through the Flex Web Service, the read-only reporting channel IBKR offers every account. You give Viktury two things: a Flex token and the ID of an Activity Flex Query. Together they let Viktury download your account statement. Neither can place an order or move money.

Everything below happens in IBKR's Client Portal on the web. The mobile app does not have Flex Queries.

Create the Activity Flex Query

  1. Sign in to Client Portal, open Performance & Reports and choose Flex Queries.

  2. Next to Activity Flex Query, click the plus to create a new query. Give it any name you like.

  3. Tick these eight sections. In each one, choose Select All for the fields, so no column Viktury reads is left out.

    • Trades
    • Cash Transactions
    • Transfers
    • Corporate Actions
    • Cash Report
    • Open Positions
    • Grant Activity
    • Mark-to-Market Performance Summary in Base
  4. Some sections ask for a level of detail. Tick exactly one level in each:

    SectionTick
    TradesExecution
    Cash TransactionsDetail
    Cash ReportCurrency Breakout
    Open PositionsSummary
    Transfersone level only
    Corporate Actionsone level only

    Two levels in one section list the same activity twice, and Viktury refuses a statement like that rather than count your trades double.

  5. Under the delivery settings, set Format to XML and Period to Last 365 Calendar Days. Leave the other settings as they are.

  6. Click Continue. IBKR then shows a review page, and the query is not saved yet. Click Save Changes at the bottom of that page.

  7. Back on the Flex Queries page, your query is in the list with a number next to it. That number is the Query ID. Copy it.

Create the Flex token

  1. On the same Flex Queries page, open Flex Web Service Configuration.

  2. Turn the Flex Web Service on and generate a token. Choose the longest validity IBKR offers, so you are not back here in a few hours.

  3. Leave the IP address restriction empty. Viktury requests your statement from its own servers, and a token limited to your home address is refused there.

  4. Copy the token.

Add it to Viktury

On the Add account screen, choose Interactive Brokers and give the account a name. Paste the token into Flex Token and the number into Query ID, then save.

Viktury checks the statement as soon as you save. If a section, level or field is missing, it tells you which one, using the same names as Client Portal, so you can fix the query and save again without starting over.

What we import

  • Stock and ETF trades, matched into round trips.
  • Currency conversions, each kept as a trade of its own.
  • Deposits, withdrawals, dividends, interest and fees.
  • Your open positions and cash balances, shown as holdings.

How often it syncs

Once a night. IBKR prepares Flex statements on its side after the trading day and limits how often a token can ask for one, so a trade you placed today appears after the next nightly sync. Pressing Sync Trades during the day does not make it arrive sooner.

Troubleshooting

  • "Your IBKR Flex token has expired". Tokens run out after the validity you picked. Generate a new one under Flex Web Service Configuration and update the token on the account in Viktury. The Query ID stays the same.
  • "IBKR rejected this Flex token". Check the token was copied whole, and that the token and the Query ID come from the same IBKR account. If you limited the token to an IP address, generate a new one without the limit.
  • Viktury names a missing section or field. Open the query in Client Portal, tick what it names, then click Continue and Save Changes on the review page. A query left on the review page keeps its old settings.
  • Today's trades are not there yet. That is expected. They arrive with the next nightly sync.
  • IBKR is not issuing a statement. Some nights IBKR does not build one. Viktury tries again at the next scheduled sync, and nothing is lost in between.