Import guide

Import your Interactive Brokers trades

Stocka reads an IBKR Activity Statement or Flex Query saved as CSV, just as IBKR writes it: no column mapping. Your trades, their fees and your dividends go into the free trade journal.

Your file is read on your device. There is no Stocka account and no upload.

Step 1

Export the file from Interactive Brokers.

An Activity Statement

  1. In the IBKR Portal, click Performance & Reports › Statements.
  2. Select the Run arrow next to the Activity statement.
  3. Choose the Period: Daily, Monthly, Annually, Year to Date or a Custom Date Range.
  4. Choose CSV as the format and save the file.

Or a Flex Query

  1. Click Performance & Reports › Flex Queries, then the + icon on Activity Flex Query.
  2. Under Sections, choose Trades with the columns listed below, set Format to CSV and pick a Period, then Continue and Create.
  3. Select the Run arrow next to the saved query, click Run and save the file.

The menus are as IBKR’s own help describes them, and can change. IBKR keeps Flex Query data for the four previous calendar years and the current one.

The file

What Stocka reads from it.

Activity Statement: the Trades section (date and time, symbol, quantity, price, commission, currency and asset class), the ISIN from Financial Instrument Information, and the Dividends and Withholding Tax sections. A negative quantity is a sale. When the statement lists each execution under its order, the executions are kept; the closed-lot rows under a sale are skipped.

Flex Query: the Trades section. Include Symbol, a date (DateTime or TradeDate), Quantity and TradePrice, with IBCommission or Buy/Sell; CurrencyPrimary, AssetClass and TradeID help. When the query lists both executions and orders, the executions are kept.

Step 2

Import it in Stocka.

  1. On iPhone, open Portfolio › Trades, tap Import or export, then Import CSV…. On iPad, Trades is also in the sidebar. On the Mac, choose File › Import Trades….
  2. Pick the file. Stocka recognises it and sets Format to IBKR Activity Statement or IBKR Flex Query, with the columns already matched.
  3. Check What’s in the file and the rows: each row says what will happen to it, and Positions after the import shows each holding’s shares before and after.
  4. Confirm the import. A backup of the book is written first. Settings › Imports can undo the whole import.

Fees, dividends, duplicates

What happens to each row.

  • Fees: the commission (Comm/Fee in a statement, IBCommission in a Flex Query) becomes the trade’s fee, written as a positive amount.
  • Dividends: an Activity Statement brings each dividend with the tax withheld from it, matched by stock and day. A Flex Query file brings trades only. Only US-dollar dividends the book doesn’t have yet (the same stock paid on the same day) are added.
  • What is left out: Stocka imports US-dollar stocks and ETFs. An option, a trade in another currency and a cancelled trade are listed with the reason and skipped. Splits and other corporate actions are not read from the file.
  • Duplicates: a trade already in the book — the same broker ID, or the same symbol, side, day, shares, price and fee — is marked Already in the book and left out, so a file that overlaps the last one counts nothing twice. A possible duplicate is the same symbol on the same day at a price within 1%; it stays out unless you turn on Include possible duplicates.

Stocka Pro

Or let new trades arrive on their own.

With Stocka Pro, create a separate Activity Flex Query in XML format (its Trades section with Trade ID, IB Execution ID and ISIN) and a Flex Web Service token in the IBKR Portal (the token is under Performance & Reports › Flex Queries › Flex Web Service Configuration) and enter both in Stocka’s broker settings; new trades then arrive on their own. Importing a file, as above, is free.

No file?

Import from a screenshot.

Take a screenshot of your broker app’s positions screen and choose Import from screenshot… in the same menu (File › Import from Screenshot… on the Mac). Stocka reads each symbol, its shares and its average cost on your device; you check each row and turn it on before it goes in. A positions screen has no buy dates, so each holding goes in with its date unknown.

Other brokers

Any other broker’s CSV.

A CSV from any broker imports, as long as it has a header row. Pick it the same way. If Format shows Other spreadsheet, open Columns and match Date, Symbol, Shares and Price, and Buy or sell and Fees if the file has them. Set Dates to Day/Month/Year or Month/Day/Year, and turn on Decimal comma (1.234,56) if the file writes numbers that way. Stocka remembers the columns for the next file of that kind.

FAQ

Questions, answered.

Activity Statement or Flex Query: which should I use?

Either imports. An Activity Statement also brings your dividends and the tax withheld from them. A Flex Query carries IBKR’s trade IDs. Stocka Pro’s automatic sync needs its own Flex Query in XML format, not the CSV one (see below).

Is importing from Interactive Brokers free?

Yes. Importing a file is free. Automatic import of new trades from Interactive Brokers is part of Stocka Pro.

Does Stocka see my IBKR login?

No. You export the file yourself and Stocka reads it on your device. There is no Stocka account and no upload.

Everything you import lands in Stocka’s trade journal: every buy and sell with its fees, your average cost, and your realised and unrealised P&L, on iPhone, iPad and Mac. The journal and file imports are free.

More import guides