All guides

Interactive Brokers

How to export an Activity Flex Query in XML format

Taxify reads an Activity Flex Query in XML format. You set up the Flex Query one time, then you use it to download any period. Do the steps exactly: if a section or a field is missing, the import runs, but the calculation can be incomplete.

1Create the Flex Query

  1. 1.Log in to Client Portal at Interactive Brokers.
  2. 2.Go to Performance & Reports → Flex Queries.
  3. 3.Click Create → Activity Flex Query and give it a name, for example "Taxify".

2Enable these sections

Enable all sections below – and no more. For each section, open the list of the fields to tick in it (the pencil icon in IB).

Trades

All buys and sells – the base of the full calculation.

Set levelOfDetail to EXECUTION, not ORDER. If not, partial fills merge into one row and the FIFO matching becomes less accurate.

Show the fields (39)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinlistingExchangeunderlyingConidunderlyingSymbolmultiplierstrikeexpiryputCalltradeIDibExecIDextExecIDdateTimereportDatebuySellquantitytradePriceproceedstaxesibCommissionibCommissionCurrencynetCashcostfifoPnlRealizedibOrderIDtransactionIDtradeDatesettleDateTargetopenCloseIndicatorlevelOfDetailorderTypeisAPIOrdertransactionTypenotes

Cash Transactions

Dividends, withholding tax, interest and fees. IB has no separate "Dividends" or "Withholding Tax" section – these are values in this section.

Show the fields (17)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinlistingExchangedateTimesettleDateamounttypetradeIDcodetransactionIDreportDateclientReference

Corporate Actions

Splits, mergers and spin-offs that change the acquisition price.

Show the fields (16)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinreportDatedateTimequantityproceedsvalueamounttypetransactionIDcode

Option Exercises, Assignments and Expirations

How the option positions closed – exercise, assignment or expiration.

Show the fields (23)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinlistingExchangeunderlyingConidunderlyingSymbolmultiplierstrikeexpiryputCalldatequantitytradePriceproceedscostBasisrealizedPnlmtmPnltransactionTypetradeID

Open Positions

The positions at the end of the period.

Set levelOfDetail to LOT, so that you get each buy of a position. If not, the FIFO state at the end of the year is not correct.

Show the fields (25)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinlistingExchangeunderlyingSymbolmultiplierstrikeexpiryputCallreportDatepositionmarkPricepositionValueopenPricecostBasisPricecostBasisMoneyfifoPnlUnrealizedlevelOfDetailopenDateTimeholdingPeriodDateTimecode

Prior Period Positions

The positions at the start of the period. Without it, older buys have no acquisition price and sells stay unmatched – then you cannot lock the tax return.

Show the fields (14)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinreportDatedatepriorMtmPnlpositionpriceopenDateTimelevelOfDetail

Financial Instrument Information

The table of the instruments (ISIN, asset class, multiplier). Without it, Taxify can resolve options and asset classes incorrectly.

Show the fields (15)

Tick at least these fields. More fields do no harm.

conidassetCategorysymboldescriptionisincusiplistingExchangecurrencymultiplierstrikeexpiryputCallunderlyingConidunderlyingSymbolissuer

Transfers(optional)

Positions transferred between IB accounts. Enable it if you have more than one account.

Show the fields (18)

Tick at least these fields. More fields do no harm.

accountIdcurrencyassetCategorysymboldescriptionconidisinreportDatedatetypedirectionaccountquantitytransferPricepositionAmountcashTransfercodetransactionID

3Check the settings

Set these values in Delivery Configuration and General Configuration. Most of them are correct by default.

Format
XML
Date Format
yyyyMMdd
Time Format
HHmmss
Date/Time Separator
; (semi-colon)
Include Offsetting Trade/Cancel Pairs?
No
Include Currency Rates?
No
Include Audit Trail Fields?
No
Display Account Alias in Place of Account ID?
No
Breakout by Day?
No

4Run the query and download the statement

  1. 1.Click the Run icon next to the saved query.
  2. 2.Set the period: From = the date when you opened the account (or 1 January of the year), To = 31 December of the same year.
  3. 3.Download the XML file.
  4. 4.Do this again for each year of the account – one file for each year.
Interactive Brokers lets you download a maximum of 365 days at a time, so you need one file for each year. Upload all years to Taxify, not only the year of your tax return: a sell in 2025 is FIFO-matched with a buy that can be from 2021.

5Upload the statement to Taxify

  1. 1.In Taxify, open Accounts and select your broker account. If you do not have one yet, create it.
  2. 2.On the Import trades tab, drop the files into the marked area or select them with the button. Upload every year.
  3. 3.When the processing is complete, you see the imported trades and you can start the tax calculation.

Tips

  • Periods that overlap are not a problem: Taxify finds duplicate trades and skips them.
  • If a sell has no matching buy, import earlier years or check the Prior Period Positions section.
  • Taxify reads only a Flex Query in XML format. It does not support an Activity Statement in CSV yet.
  • You can enter trades from platforms that Taxify does not import yet by hand, in the account detail.

Problems with the export?

Write to us and we help you with the specific step.

Contact support
Guide: import from Interactive Brokers | Taxify