AI musings

When I hedged the dollar I did this by buying eur futures in my manual/special/junk account. Of course that account did very well since then, but I’m happy to say that the other accounts have recovered as well, i.e., in euros they are above the February levels. Lately the asset allocation portfolios (most of my money lives there) have joined the party, while trend following and the day trading strategies have been doing well for longer. The asset allocation portfolios get hurt when there is elevated, but not extreme, volatility. The dollar used to provide a cushion in these times but in the last round the dollar was the cause of the problems. I’m not sure what to do with it. For now I’ll keep the hedge because the dollar seems to be deliberately weakened. Still, in the next market correction everybody might be screaming for dollars again. You can’t ignore it is the currency of the largest economy. My trading might be systematic, but these are still choices I have to make and they keep me up at night.

My intraday program can now mix mini and micro futures. For instance if I need to buy 2.3 NQ futures, that would be 2 NQ’s and 3 MNQ’s. On top of that multiple strategies can trade the same contracts and I have a nice visual way to represent the positions. It was harder than I initially thought and at one point I threw away everything because it became way too messy. Taking a step back gave me an idea for a clean solution that will benefit me in other ways as well: I’m also working on strategies based on cointegration. To facilitate this I wanted to develop a specialized backtesting engine. Yak is used for asset allocation backtests, Bison for intraday technical analysis based strategies. It seemed fitting to add another bovine to the zoo: the Buffalo.

At about the same time as I got this idea, I upgraded my AI assistent to an AI agent and was very impressed with what it could do. It made me wonder if it was possible to develop an entire program with the help of the AI agent. Long story short: not yet. Initially I liked the idea of being promoted to project manager instead of a humble programmer. It was like having someone code for you, but instead of sitting down in the morning, explaining what should be done and then waiting for a day to check how far they got, the AI would be finished in 5 minutes. Initially things were progressing very well, and quickly glancing over the resulting code it looked like a job well done. But when the program was in such a state that the first tests could be done it was clear there were all sorts of bugs. Despite being very optimistic (the AI’s seem borderline ADHD’ers) it could not pinpoint the cause of the bugs. Let me give an example: one task would be to load data of NQ, ES, YM and RTY futures, starting in 2025. For some reason the NQ data did not start in January but later, in March. As a human, it quickly became apparent to me that the datafiles weren’t loaded in order of ascending dates. The AI made the strangest additions to the code to either understand the problem or make it go away, but to no avail. A couple of lessons here: if your AI can’t do what you want it to do: start over or do it yourself. Also, don’t put it under pressure. It seems to make less mistakes when you are gentle with it.

The AI’s may not be ready yet, the progress is remarkable. Right now, we are still needed for the ideas and the analysis but this is quickly changing. Then again, in 2015 I remember saying that in 2020 all new cars would be fully autonomous. It’s now 2025 and I’ve just encouraged my youngest son to get a drivers licence. Oh, and I was the one that said that google was overpriced at its IPO. I’m terrible at predicting the future.

A new addition to my zoo

For several years already I have made weekly posts on a forum on things that keep me busy related to trading. It might be a good idea to do those posts here from now on. Anyway, for people on that forum the title of this post will be less cryptic than for others that don’t know me. Most of my programs are named after animals. I’ve gathered quite a collection already:

  • Dolphin, my real-time risk management system
  • Octopus, a trade logger
  • Woodpecker, a real-time trading engine
  • Yak, a simulator / backtester for asset allocation strategies
  • Bison, a backtester for intraday strategies
  • Swordfish, a dartboard for manual trading
  • Aardvark, a trading strategy
  • Kangaroo, a trading strategy
  • Elephant, a data gathering tool
  • Saint Bernard, a helpful dog that keeps track of running programs

There are others, like Donkey, Axolotl, Tarantula but those are largely defunct. Currently I’m working on Buffalo, which I thought was a fitting name for a new backtester/explorer for strategies based on cointegration. Most of my programs have the same look and feel (if they are gui programs) and that’s because I usually start developing a new project by issuing a single command:

./createProject.sh <project name>

This sets up a complete directory structure for the new project and fills it with relevant class files (I’m using java), and puts them under version control. Automatically I have a program that has the basics of a gui (that remembers its location and size) or headless application, command line handling, license processing, (remote) logging, configuration settings, splash screens, and help/about forms.

It’s pretty cool, because this is always tedious work which is now done with just this single line. The only thing I have to do afterwards is add an image for the splash screen, an icon and a function that returns a description of the projects purpose.

Normally after this my work really starts, but this time I’m working with an AI agent. So far the results of this collaboration have been mixed: the AI is often surprisingly good at making code, and sometimes it doesn’t seem to understand some basic programming structures. What I’ve learned so far is that if the AI doesn’t get it right in three or four times, don’t try to push it further. It will only add more bloat. Better to debug and fix the program yourself.

I like programming, it can be challenging but also very rewarding. In a sense it’s a pity the AI’s are on the rise because they take over so much of the work that I used to enjoy. So why use them? Because they also take over much more work that is boring. There seems to be no middle ground here: either you use the AI or you don’t. For this project I’ve chosen to use one. It feels like I’ve been promoted from programmer to project manager, because that’s what the work has been transformed into. I’ll let you know when or if I have demoted myself.

The permanent portfolio loves volatility

The drop in equity markets in Q4 of 2018 has hurt a lot of peoples portfolios. Strangely enough, the permanent portfolio loves these periods of high volatility. In itself it will not decrease in value dramatically because that’s what it is designed to do: when markets are nervous, money flows from equity to gold and/or bonds. When things return to normal money flows back but for some reason you end up with a higher value for your permanent portfolio. Even without rebalancing. I have seen this phenomena many times and my best explanation is that in the first round gold and bonds are bid up by the so called weak hands fleeing out of stocks, and in the second round additional money flows from smart money, that was parked on the sidelines, into stocks again.

Whatever the cause, I’ve now seen this happening so many times that I rejoice when markets drop. It doesn’t make me a popular guy at parties but I’ll accept that!