The initial development of the Python code took about half a day using ChatGPT. The next day I added the html code to my easy2boot.xyz website as a 'private' page which you can see here.
ChatGPT initially used the much better v5.5 engine, but as I was on a free version, it soon downgraded me to a lesser version after a while and that was where things started to go wrong. Previously, it had been performing well, but now it started hallucinating, changing the working code for no reason, forgetting changes, completely re-writing what was perfectly honed code and breaking things all over the place.
Codex
While using ChatGPT, I noticed the 'Codex' link on the left hand side of the ChatGPT window. so I downloaded the Codex app and signed up for a subscription at £16.67 a month with the first month free - and WOW was I impressed!
It's like telling a professional web coder what I wanted and five minutes later it had built an html file which I could immediately test in the preview window. It was then a question of more testing and debugging, adding features and altering the appearance and messages. It took me half a day and I never wrote a single line of code - ever!
Project 3 - Capital Gains Calculator for shares
My next project was with Codex was to create a web page that performs a similar function to cgtcalculator.com. It should obey the HMRC same-day, 30-day and Section 104 rules and give the same results as cgtcalculator.com. After a few hours it was working and giving the same results. Here is a screenshot of the page:
Project 4 - ERI Lookup
A local tax-support / portfolio analysis tool for identifying potential UK offshore reporting fund ERI entries from trade history.
My Invest GIA portfolio used to contain Accumulating ETFs. I learned a few years ago that HMRC still require investors who have Accumulating offshore ETFs (they are nearly all offshore - usually Ireland or Luxembourg) to declare the annual dividends even though they are not actually paid out.
This means we have to calculate these dividends (called ERI or Excess Reportable Income) which is an extremely tedious process.
- The first part is to find the ISIN number from the ticker.
- Next we need to look up what the Reporting date is for this particular fund.
- Next we need to find out how many of the fund shares we were actually holding on the Reporting date.
- If we were holding any stock, we need to calculate the ERI for that tax year which is 6 months later than the Reporting date. For instance, if the we held stock on the reporting date of 31 December 2024, we have to declare the ERI as being received on 30 June 2025 which is in the next tax year.
- The amount of ERI is Qty x ERI. We must look up the ERI (e.g. $5.3 per share) on the provider's web site (e.g. iShares website) and look for the ISIN number and the Reporting date and the Distribution date which is always 6 months later. This report is issued annually by each provider as a separate document containing many funds from the provider and one document is issued each year containing all their funds. If the ERI is not in UK GBP, we must convert the ERI currency to GBP using the effective rate for that currency on the Distribution date. So in our case, we look up what the USD/GBP exchange rate was on 30 June 2025 and multiply it by $5.3 and the number of shares we held on 31 December 2024. The figure we get is then declared as a dividend (although sometimes ERI should be counted as income - e.g. with some money market funds).
Simples!
Finally, if we sell the Accumulating ETF, we can add up all the ERI we have ever declared on it over the years we have held it, and add it to the cost of the shares (this reduces the gain we made on the shares when we sold them which means we pay less CGT on that gain). If we sold only half our holding, we must divide the total ERI notional dividends by 2.
Most Distributing ETFs do not have any ERI (but not all!), so strictly speaking we should also check Distributing ETFs for ERI as well (each year!).
However, I wanted an app which would run through my entire list of orders and tell me how many of them I held on their Reporting date and would allow me to easily look up what the ERI was for any year.
The app. below tells me which tickers are ETFs, it finds the ISIN number on t'internet, checks it is a HMRC-recognised Reportable fund, calculates how many I held on the Reporting date, and then tells me which tax year the Distribution date is in because I will need to lookup and declare the ERI as dividends for my tax return.
An ERI button for each ticker/ISIN is provided which links to the KPMG website where you can paste in the ISIN and look up the amount of ERI for any year (which works 90% of the time).
| My homemade ERI web app. The ERI Lookup buttons open the KPMG search page. |
| KPMG lookup site (requires ISIN number or ticker which is already in the clipboard. |
| Essential info can be found for most funds using the KPMG search site |
My web-based app was quite complicated.
Here is Codex's own description of this app. which I may transfer to a website at a later date.
This is a local browser-based utility app for checking whether holdings in a portfolio may have UK offshore reporting fund / ERI implications.
It is not a normal hosted web app yet. It is a local HTML page backed by a small local Node.js server.
What It DoesThe app takes trade data in `cgtcalculator.com` format and works out which funds/shares you held on each fund’s reporting date. If you held units on that reporting date, the fund may have Excess Reportable Income (ERI) that needs checking for the relevant UK tax year.It produces two main outputs:- Summary: a tax-year grouped list of possible reportable holdings.- Analysis: detailed lookup/debug information for each ticker.The Summary shows items such as:`ISIN`, `Ticker`, `Type`, `Dist. date`, `Qty`, `Held on`, and `Fund name`.It also creates ERI Lookup buttons for ISINs, which copy the ISIN to the clipboard and opens the external KPMG reporting funds site so the user can manually check the actual ERI figure for a particular tax year.How It WorksThe workflow is roughly:1. The user pastes or loads trades.2. The app parses buy/sell rows in this order:`Buy/Sell, Date, Ticker, Quantity, Price, Charges, Tax`3. Trades are sorted by ticker and date.4. For each ticker, the app tries to identify the correct market instrument and ISIN.5. It checks the uploaded HMRC Approved Offshore Reporting Funds file to see whether the ISIN is listed.6. It estimates or infers reporting/distribution dates from known provider patterns.7. It calculates whether the holding quantity was above zero on the reporting date.8. It reports only those holdings where shares were held on the reporting date.Technology UsedThe front end is a single HTML file:[Check_ERI.html](C:/Users/steve/Documents/Codex/2026-05-11/new-html-project-called-check-eri/Check_ERI.html)It uses:- Plain HTML- Inline JavaScript- Minimal inline element styling- Textareas for input/output- No external CSS framework- No build step- No databaseThe local server is:[Check_ERI_server.js](C:/Users/steve/Documents/Codex/2026-05-11/new-html-project-called-check-eri/Check_ERI_server.js)It uses:- Node.js- Built-in HTTP/HTTPS/file modules- Server-side proxy calls to Yahoo, FT Markets, JustETF, etc.- Server-side parsing/indexing of the HMRC Approved Offshore Reporting Funds fileThe server is needed because browsers block many direct finance-site requests due to CORS/security restrictions.External Data SourcesThe app can use several lookup sources:- Yahoo Finance for ticker/name/type/basic instrument lookup- FT Markets for ETF ISIN fallback lookup- JustETF for distribution policy and fund name- HMRC Approved Offshore Reporting Funds file uploaded by the user- Provider-date assumptions built into the app- Manual fallbacks for specific awkward tickersImportant LimitationThe app does not calculate the ERI amount itself. It identifies likely cases where ERI needs checking. The user still needs to use the ERI Lookup buttons and external reporting fund sources to find the actual notional income/ERI rate.
I might have been able to use some free APIs, but I wanted to avoid this.
I have tested it with over 100 different tickers/orders.
Usage
I can paste my Trading 212 or other trades into it and it will tell me which ETFs I was actually holding on their Reporting dates and which tax year each ERI notional payment was in. This means I only have to try to find out the ERI for a much smaller number of ETFs.
I need to now manually look up the ERI on the KPMG site for each of the Accumulating funds using the ERI Lookup buttons - ugh! This is why I have now moved most over to using Distributing funds in my stock portfolio! e.g. XLKQ is a synthetic accumulating fund, it's ERI for 31/05/2025 (note the dates appear to be wrong in my app - it's not perfect for all tickers just yet!) was $4.3653 and I held 7.542 shares = $32.92. The USD/GBP exchange rate on 31/05/2025 was 0.7427 (according to ChatGPT) = £5.60 ERI.
[Note: if the KPMG site does not return any information for the ISIN number and year you need, you have to try to find the Reportable Income PDF or CSV on the broker's site!].
I should now do this for all the accumulation funds too!
HMRC reporting: Since we can subtract all the ERI from the gain we make when we sell the shares, and a UK basic rate tax payer pays 18% CGT on gains, but only 8.75% tax on dividends, by not accounting for ERI, a basic rate tax payer will actually pay too much tax, as long as they sell the ETF. So I don't think HMRC will complain too much. Also, the ERI on Accumulating funds is usually quite small as there tends to be growth companies in acc. funds, not companies that pay big dividends.
You can see why I avoid Accumulating ETFs in my GIA accounts now!
My experience with Codex
I have not had any serious coding experience for many years. I don't know hardly anything about html or scripting inside html. Codex just did what I asked and it always worked! It set up some test scripts inside a test environment, ran some powershell scripts to start the .js server script, changed the code and then tested it afterwards and provided me with a drop down source code difference box (like the github changes diff box) so I could see the changes.
To be honest, I was blown away. What would have taken me many weeks was accomplished in a day (and with no html/web/script experience). It did absolutely nothing stupid. Most of the time it exceeded whatever I asked it to do.
I would urge anyone to have a go. You can even chat with Codex first to discuss what you want to do and how best to achieve it before building the app. If you don't know what to do, just ask it to do it for you.
Of course, whether the final code is robust and up to professional standards is another matter, but I can see why a whole coding department could now be replaced by just a few junior programmers on Codex or Claude or whatever, and then add a few experienced programmers to evaluate it and harden the code and then add a few testers/validators. Codex could help at all stages. It could point out weaknesses, harden the code to deal with exceptions and edge cases, do some input and range testing and even document it.
No comments:
Post a Comment