Interactive Brokers portfolio tracker: return, dividends and tax from a Flex Query
Connect IBKR through a Flex Query, or upload an Activity Statement. hedger works out the return over any period, dividends after withholding tax, sales with the time test and the figures for a Czech tax return.
What you see
- The return over any period – a day, week, month or year – as TWR and as the return on your money (XIRR), next to the S&P 500 and inflation.
- What the gain is made of: prices, currencies, dividends and interest, fees.
- Dividends and interest with the tax withheld abroad.
- Sales paired with their buys (FIFO) and the 3-year test.
- Everything in crowns, euros or dollars, at each day's ČNB rate.
- The tax return: the annexes and the XML for EPO.
- Every number traces back to the statement line it came from.
Connecting the account
- In the IBKR Portal open Performance & Reports → Flex Queries and click + at Activity Flex Query.
- Tick the sections Trades (Executions), Cash Transactions, Corporate Actions, Transfers, Grant Activity, Cash Report and Open Positions; “Select All” in each.
- Delivery Configuration: Format CSV, Include column headers Yes, Include section code and line descriptor Yes, Include header and trailer records No, Period Last 365 Calendar Days.
- General Configuration: Date Format yyyyMMdd, Time Format HHmmss, Date/Time Separator ; (semicolon). Save – the Query ID is next to the query's name.
- On the same page, in Flex Web Service Configuration, switch the service on and generate a token. Paste the token and the Query ID in hedger's Settings at the account.
A Flex Query reaches back a year at most. Upload older history once as an Activity Statement – what overlaps isn't counted twice. After that new activity arrives every day on its own.
Or upload a statement
- Log in to IBKR Client Portal and open Performance & Reports → Statements.
- With several accounts, first Select Accounts and pick all of them. Then Run next to Activity Statement.
- Period: custom range (IBKR allows at most 1 year; download older years separately). Format CSV, language English. Download.
- For automatic downloads set up a Flex Query in Settings → Accounts.
What we read from it
- Trades in shares, ETFs, bonds, options and futures.
- Dividends, interest, fees and the tax withheld abroad, from the cash transactions.
- Corporate actions – splits, spin-offs, mergers, tender offers and rights issues – and transfers between accounts.
- Shares from an employer (Grant Activity).
- Several accounts under one login in one query; each row goes to its own account.
Questions
A Flex Query or an Activity Statement?
A Flex Query for the ongoing download (every day on its own), an Activity Statement once for history older than a year.
What if the token expires?
The token is valid a year at most. When it expires, hedger tells you in Needs you, and you generate a new one.
I have several accounts at IBKR.
Pick them all in the query – one connection is enough. Accounts not in hedger yet are created, and transfers between them count.
Create a free account · Tax return from Interactive Brokers · Portfolio tracker for Trading 212