EDIT: lol. I had some serious bugs in my code, so ignore those numbers. The real ones are less extreme :D
To try and crack down on my almost comical tendency to overwork and be working 100% of the time, I decide to do some ‘fun’ coding today instead of work, to help me ‘relax’, which is something people keep telling me to do. Obviously I’m still me, so it involves programming..
I dabble on the stock market (I used to work up there many lifetimes ago) and something I have long found infuriating is the absolute awfulness of UK retail stock-market reporting. Its almost like they don’t WANT you to know if you are making money or not.
My broker (Hargreaves lansdowne) is great at telling you your current profit or loss as a percentage and in financial terms, on each trade, but this doesn’t take into account how long you held the stock, rendering it effectively useless. If stock A has been held 4 years and is up 4%, thats way less attractive than stock B, which I bought last Wednesday and is already up 1%. They make it IMPOSSIBLE to get the real ‘;annualized’ figure.
What I wanted was ‘the rate of return, if I held this stock for a year, and the stock growth was linear over that year, given its growth during the time I held it’.
It turns out, to do this, I had to copy and paste a bunch of PDF files into .txt files, then write my own code to parse it all and rearrange it into a CSV so I could visualize it using excel. This also meant grabbing a copy/paste of today’s prices for stocks I still hold and have not sold, and then doing the SUPER TEDIOUS work of copying and pasting dozens of names, because it turns out HL use ‘different text’ to describe a stock in their PDF reports than they do in their live prices (grrr). Its also annoying that they changed their formatting about 2 years ago to include the exchange code, so I had to detect those and strip those out of some lines of text. Plus there are other errors, and missed text here and there, meaning my results are (so far) probably not 100% accurate.
I suspect all the data I *do* have is correct, but in some cases there are some missing buys and sells, so I’ve effectively ignored those stocks.
Still…it amused me for over half a day, and means I can bask in my glory on these stocks:
And cry into my sleep about these…
None of it is as good/bad as it looks, because the results are annualized. For example I think I held my bitcoin for about 48 hours, and some of the others I held for very short periods as well. Its probably worth doing some sort of clever smoothing code to work out which are the ‘long term good picks’ versus me just getting lucky over a week or a month.
My TSLA stock is a good example. I’ve made a series of buys (and one sell) over a great many years, and although its been very volatile lately, the ROI on an annualized basis is looking pretty sweet. The Biotech Growth Trust is also looking pretty cool, and I’m also happy with Materialize and Teradyne.
I should probably do that pointless legalese bullshit here that says ‘this is not advice’, but frankly if you take stock picking advice from a British Chocaholic game developer who likes to drink a lot, then you probably aren’t going to listen :D.