Interactive Brokers (IBKR)¶
cgt-calc reads the CSV downloaded from the Transaction History page in the Interactive Brokers Client Portal. It does not read Activity Statements, Flex Queries, PDFs or Excel files.
Use an account whose base currency is GBP. The importer checks the base currency in the CSV and rejects other currencies. Include taxable accounts only; activity inside an ISA is outside the capital gains calculation.
Export the transaction history¶
Export the complete history rather than only the tax year. Earlier acquisitions can still affect disposals in the year being calculated, and the cash deposits at the start of the account help the balance check detect an incomplete export.
- Sign in to the Interactive Brokers Client Portal in a web browser.
- Open Performance & Reports → Transaction History. Alternatively, open Menu → Reporting → Transaction History.
- Select Custom as the period and set the start to the account's first transaction. Set the end to today, or at least 30 days after the end of the tax year you are calculating.
- Clear any transaction-type or symbol filters so the export includes trades, income, fees and cash movements.
- Download the table using its CSV export control.
IBKR's current Transaction History instructions show the menu path, period selector, column configuration and filters.
Keep the downloaded CSV unchanged. The filename does not matter.
Do not substitute an Activity Statement or a Flex Query CSV: their sections and headings are different even though they are also available from Performance & Reports.
You can compare the file's structure with the synthetic example CSV.
Generate the report¶
For the 2025/26 tax year, run:
cgt-calc --year 2025 --interactive-brokers-file U12345678.TRANSACTIONS.20240101.20260505.csv
--year 2025 means 6 April 2025 to 5 April 2026. Follow Generate Your First Report
to find and check the output.
The Transaction History export contains cash deposits and withdrawals, so a complete export should
normally pass the balance check. Do not add --no-balance-check simply to bypass an error; first
check the date range and filters as described in Troubleshooting.
Supported activity¶
The importer recognises these literal values from the CSV's Transaction Type column:
| Transaction type | How cgt-calc handles it |
|---|---|
Buy, Sell |
Share or fund acquisitions and disposals, with commission |
Dividend, Payment in Lieu |
Dividend income |
Foreign Tax Withholding |
Tax deducted at source; treated as dividend tax |
Credit Interest |
Interest income |
Deposit, Withdrawal |
Cash movements used by the balance check |
Other Fee, Forex Trade Component |
Charged against the cash balance as fees; no security is bought or sold |
Adjustment |
Cash-balance adjustments such as FX Translations P&L |
For a GBP-base account, IBKR reports gross amounts, commissions and net amounts in GBP. When the CSV
also supplies Price Currency and Exchange Rate, cgt-calc converts a foreign-currency unit price
to GBP before calculating the acquisition or disposal.
IBKR descriptions for dividends and payments in lieu can put an ISIN in parentheses immediately after the symbol. cgt-calc uses that identifier when deciding whether a supported double-taxation treaty applies.
Known limitations¶
- Only the transaction types listed above are mapped. Any other value stops the import with
Unknown type; do not delete the row merely to make the calculation run. - Cash
DepositandWithdrawalrows are supported, but transfers of shares or funds between accounts are not. Corporate actions such as splits, mergers and spin-offs are not mapped from an IBKR export either. - The importer does not read an asset-class field. It has been validated for ordinary share and fund trades; do not rely on it to calculate options, futures, bonds, contracts for difference or crypto assets.
- Every
Foreign Tax Withholdingrow is treated as dividend tax. If IBKR withholds tax from credit interest and does not reverse it, cgt-calc records that amount against a placeholder symbol. It reduces the cash balance but is not reported as interest tax in the summary. - The
Accountcolumn is not used to keep separate ledgers. Rows for multiple taxable IBKR accounts in one CSV are combined under one broker balance and portfolio.
Troubleshooting¶
Unexpected base currency¶
The CSV says that the account's base currency is not GBP. Changing the text in the file would not convert any amounts, so use a GBP-base account export instead.
Couldn't find Transaction History header¶
Check that the file came from Performance & Reports → Transaction History and is the CSV export. Activity Statements, Flex Queries and files converted from PDF use different layouts.
CSV header mismatch¶
The Transaction History page lets you configure its columns, while cgt-calc requires the fields it
uses and rejects fields it does not recognise. Export the standard table without changing its
columns. Price Currency and Exchange Rate are accepted optional columns.
If an unchanged export still fails, first upgrade cgt-calc using the same method you used to install it. If the error remains, open a GitHub issue with:
- your cgt-calc version from
cgt-calc --version; - the complete error message; and
- the CSV header and a sanitised failing row.
Do not upload an unredacted file: the report contains account identifiers, holdings and other sensitive financial information.
Unknown type¶
Compare the named transaction type with Supported activity. The row may represent an unsupported corporate action or position transfer. Do not remove it unless you replace it with an equivalent supported transaction whose UK tax treatment you have verified.
Reached a negative balance¶
Re-export the history from the account's first transaction and make sure no transaction-type or symbol filter is active. A shortened or filtered export can omit the deposit, sale or dividend that funded a later transaction.
Use --no-balance-check only if you have confirmed why the export cannot reconcile and have checked
its completeness another way.