Burgers, human and machine learning in trading

20170114 Burger

OK, I admit it I quite like burgers. However, what makes a good burger? I’ve had many (perhaps, some would speculate too many) burgers over the years. First, there is not necessarily a linear relationship between the price of a burger and the quality. Admittedly, the quality of beef in a fast food burger is generally better, however, spending 40 USD on a burger doesn’t necessarily make it much better than a 20 USD burger. In fact, when burgers I’ve tried have been very expensive, it has been because they’ve had totally unnecessary expensive ingredients like duck liver pate. Adding more and more ingredients to a burger doesn’t always improve the final outcome (yes, I’m looking at you Gourmet Burger Kitchen who make the Kiwiburger, with outlandish ingredients such as pineapple and beetroot… a pineapple belongs on a desert island not on a burger…!). If anything, simplicity in a burger is the secret: good quality bread, a well made beef patty with some nice filling, perhaps some lettuce, tomato and onion, finished with some sauce. I would argue that spending more on better quality core ingredients (like the beef), improves the taste of the burger, rather than spending that money on more filling. There is an upper limit to how much a human can consume in one sitting and to how many flavours we can identify. Perhaps the most crucial part of a burger is the chef cooking it. If a burger is burnt to a crisp, no matter what the ingredients are, it isn’t going to taste good.

 

So what has this got to do with machine learning? Machine learning is one of those glorious buzzwords, which sounds so enticing, just like our (supposedly) super amazing, duck liver pate burger (ok, that probably isn’t enticing for everyone). What exactly is machine learning for starters, once we’ve gone past the buzz? The basic concept is pretty simple and its about making inferences between sets of variables, for the sake of argument, we might want to identify the relationship between the change in yield differentials and FX rate returns. We could use a traditional method such as a linear regression. In practice, you probably wouldn’t implement this, as there are many code libraries which already do this. However, you should at least have an understanding of what the method does, even if you’re not going to implement it from scratch. In this instance, our hypothesis is that there is likely to be linear relationship between the change in yields and FX rate returns. Hence, if we were plotting EUR/USD FX returns on an x-axis, and the change in EUR-USD 2Y yields on a y-axis, we’d end up with a scatter plot, which we could draw a straight line of best fit through. If we do this, we’d see a pretty strong linear relationship (in fact there is for nearly every developed FX cross!). The R^2 gives us an idea of how good the line of best fit is. We can then use the analysis in the future to judge whether FX returns have overshot versus the move in rates and use this in the basis of an FX trading strategy.

 

However, let’s say we don’t know the relationship is linear beforehand. In fact we have no idea what the relationship is, and it could be some weird unusual non-linear function. We can use various more complicated algorithms such as support vector machines, random forests etc, do draw “lines” (or hyperplanes if we have many variables) of best fit. All these algorithms (including I would say linear regression) are what are often referred to as machine learning. Again many of these algorithms have already been developed and are often available in open source, and in practice, most people using them are unlikely to implement them from scratch.

 

The question however, is do these more complicated techniques always give us better fits out-of-sample, or are we just fitting it massively in-sample? In other words, how robust will our findings be, when we observe new data and further more are we even optimising for the right thing? Is it sometimes simply better to start with simple techniques like linear regression and see if they work first? This is particularly true of the world of financial markets, where the problems we are trying to solve are very different to those where machine learning has been successful, such as facial recognition? Is machine learning in trading, the duck liver pate of our burger story, a fancy ingredient, which isn’t always necessary? I’m not trying to rubbish machine learning, when it comes to trading, just asking whether using it as a first port of call is the best idea.Admittedly, I’m not the only person to have talked about this point, I’ve seen many others making similar comments on Twitter such as @robinhanson and @quantian (and I got the idea of this article from seeing their tweets!)

 

It’s something I’ve written about many times before, but I’m not convinced that there is a correlation between the number of lines of code in signal generation of a trading strategy and how impressive it is. Yes, there might be many thousands of lines of code, but most of them deal with handling data and are relatively generic between different trading strategies, often the real “value” of the code for a trader is in the signal part. Some of the best trading strategies I’ve developed literally have only a handful lines of code to calculate the buy/sell signals – what was difficult and took time in developing them was using intuition to know where to look in the market! You could also argue that perhaps what could be even more important than the technique you use to number the crunch the data, is the data itself. If you have unique dataset, that could be very useful indeed, even when simple analytical techniques have been applied. The *most* important thing I’ve done over the years in markets, is actually *human learning* of the market, observing how the market behaves in relation to events, talking to traders and reading about markets. I’ve then used these observations to form hypotheses for developing trading strategies. Of course, doing coding and maths is also important, but I very much see this as a tool alongside understanding the market, rather than as some sort of replacement.

 

Next time I’m going to have a burger, I think I’ll just stick to a simple cheeseburger!