UK CGT tax calculator for Interactive Brokers


This is a project we're about to start work on. Currently if you trade with Interactive Brokers as a UK trader, you'll appreciate there's no simple tax report you can run off to use to fill out your annual self assessment. Our plan is to provide a simple tool, whereby you can upload your trade report, exported from IB, and we'll generate a report calculating your CGT - simple!

We'll be utilising Rob Carver's excellent open source library 'Python UK trading tax calculator'. Those with a smattering of knowledge of python and git can go direct to source and run this locally, you'll just need to source the FX rates. Those without, or just too lazy to set it up themselves, will be able to use the tool here on T2W. Thanks to Rob aka @globalarbtrader who I've run the idea past and likes it.

We'll need some beta testers at some point, so if this sounds interesting to you, then do let us know and we'll include you in any testing we do.
Having just completed my UK self assessment tax return, and having had for the first time to account for unsheltered options trades in an Interactive Brokers account, I can tell you first hand, it's painful! My hope was to use Rob's calculator to assist; but it quickly became apparent there were a couple of major issues. Firstly, the code that deals with fx rates from a quandl, a free source, is outdated an no longer working; secondly, options isn't supported presumably because Rob doesn't trade options; it's easy enough to enable the processing of options trades, but I'd need more time to understand what the implications are of handling the various options outcomes would mean. So in the end I pulled in the data to an excel spreadsheet from IB's reporting and looked at the trades one by one. One of the gotcha that I discovered was if you have any sort of spread options trade with say one side selling to open (thus taking into a credit), if you haven't closed that leg prior to the end of the tax year; it's considered by hmrc an immediate taxable capital gain; meaning that in the following tax year when you buy to close it; you then have to claim the capital loss; the cost of closing it 🤦‍♂️

For my UK and US stock trades, I ended up writing javascript code to take as an input IB's activity report (trades list) and output it in a format that can be read by at the same time calculating the fx rates for all the US stocks on the days of the trades; this way you're covered for things like same day rule, 30 day rule, section104 holding.

I get the impression that others perhaps don't even take this trouble, and probably just send the activity reports in IB to their accountant expecting them to be able to use the summary information.. and going from my experience with accountants they probably just do that; and not take the trouble to do the math; end result as proven from this recent experience is that the actual CGT numbers differ wildly.
It would be very much in the interest of HMRC to tax capital gains as soon as they deem it liable as it will give a major boost to tax income. As you say, it is unlikely that all accountants will even begin to understand how this works. Maybe there is an opportunity to set up an automated way for traders to do these calculations as it appears to be much needed. Are you still using Steady Options ?
I think there's definitely a need in the UK for such a tool, I'm just not sure how big an opportunity it is. Steady options - no, I was trading their SteadyVol strategy but IB isn't viable, because of the commission costs - it would have to be with one of the US brokers where the commission on options trade, especially multi-legged trades is much cheaper, and I preferred to stick with IB.

I recently put together a web wrapper for another tool Bittytax. It is at A bit similar to cgtcalculator but does the currency conversions. The software is crypto focused but does all the UK share matching rules.

It works fine for stocks and should work for options (in a way at least), I have had a bit of a go with it, but I am not at tax season yet. Anyway I use options on IBKR.