A Recurrent Neural Network Framework for Predicting Asset Returns 

 

The investing profession is unlike most other professions. To achieve excellent performance you need to act differently than the majority. If a group of proficient engineers collaborate in building a light bulb, they’ll probably come up with a well designed light bulb. This is because there is a solution to this problem that doesn’t depend on other light bulb designs. A light bulb is not a complex adaptive system. In the markets, a similar group of collaboration would not lead to an excellent outcome. Whatever the majority perceives to be right gets priced into the market. It is therefore necessary that actions of the excellent professional are contrary to the opinion of the majority. Of course, this is not yet a sufficient set of conditions. Importantly, the conclusions giving rise to the actions have to be in some kind of way better. I have no doubt the reader realizes that the first element of this argument is contained in the second one, as ‘better’ necessarily implies ‘different’. I think it is useful nonetheless to state the condition explicitly as to not set oneself up for failure. In a strict sense, all the efforts directed to reading books, blogs, news, analyses, and basically anything else by other people would be wasted, not even pointing out the fact that in many cases if they really had this informational edge, why would they sell it to you instead of acting on it themselves gaining much more in the process. I think the argument in its strict form is not always true as e.g. value investing capitalizes on superiority of emotional stamina instead of an informational advantage.

Instead of following well known investing strategies, I’m focussing my efforts on developing systems that generate truly unique strategies. For that it’s useful to state fundamental principles that excellent investing strategies must abide to, and reasoning from there upwards.

  1. Diversification with uncorrelated (or even better negatively correlated) return streams
  2. Compounding
  3. Reducing the risk of catastrophic losses to practically zero
  4. Having an edge

The standard deviation of a portfolio’s return stream declines with the square root of the number of uncorrelated assets (n) within that equally weighted portfolio. It is critically important that these assets — or rather the income streams from trading these assets, which are not the same thing — are uncorrelated. If you had a portfolio of 30 equally weighted assets, and these assets would give you income streams 60% correlated with each other and each stream had a Sharpe ratio — the expected excess rate of return divided by its standard deviation— of 0.2, then the portfolio Sharpe ratio would be: Sharpe_c = n*0.2/(n + 2*n(n − 1)/2 *0.6)^0.5 =0.255. Combining correlated assets only results in a small reduction in risk. Contrast this with the Sharpe ratio assuming uncorrelated assets: Sharpe_u = n*0.2/(n)^0.5 = n^0.5 * 0.2 = 1.095. Here the covariance part of the variance vanishes. The result is a much higher reduction in risk. Furthermore, asymptotically, as n gets large, the risk approaches zero in the uncorrelated case but not in the correlated case. To illustrate, if you would include 100 assets in the portfolio instead of 30, you would get a Sharpe ratio of Sharpe_u = 100^0.5*0.2 = 10*0.2 = 2 in the scenario where the return streams are uncorrelated. Again assuming 60% pairwise correlation, the Sharpe ratio is a mere Sharpe_c = 0.257 for the n=100 portfolio, almost no improvement against the n=30 portfolio.

As I, and this blog, started out with the value investing philosophy, I will shortly run this philosophy by the aforementioned principles. The core principles of value investing match point 2, 3, and 4 — point 1, however, is at odds. Since most value investors are long only stock pickers, diversification is a serious challenge for them. First since a comprehensive fundamental analysis is necessary to evaluate whether or not the investor has an edge in his favor, he will soon reach the limit of his capacity. It is simply not feasible to evaluate thousands of opportunities to come up with a selected basked of, say, 100 stocks without compromising quality. But even if he could, it would not result in true diversification as stocks are correlated and as n gets large the total variance is dominated by the covariance part. This is the reason why many value investors declare diversification beyond a certain threshold — typically between 5 and 50 — as useless and instead focus their funds on their most cherished ideas. If thats not enough to convince you that value investing, as it is practiced by most individuals, has a problem with diversification, consider the fact that Asness et al. (2013) found that the value premium is correlated across asset classes. So even if a more sophisticated value investor would consider a long/short value strategy across even uncorrelated asset classes, the transformation his investment strategy would apply to the asset return streams would yield correlated portfolio constituents. To be clear, I don’t discount value investing as a valuable part of a portfolio. It just can’t be an optimal strategy on its own.

Let’s return to the fundamental principles. The second principle is compounding. As Albert Einstein reportedly said  “Compound interest is the eighth wonder of the world. He who understands it, earns it … he who doesn’t … pays it.” Simply put 10% compounded for 100 periods is not 100*10% = 1,000% but 1.1^100-1 = 1,378,000%.

The third principle can be summarized as ‘everything times zero is zero’. It doesn’t matter how stellar one’s track record was, if there is one devastating year, it was all for nought.

The fourth principle is to have an edge. What is meant by this is basically that one has some kind of advantage over one’s competitors such that the expected value of one’s efforts is positive. The easiest —but not the only— way to gain such advantages is to carefully select one’s competitors. The harsh truth about trading the secondary markets is that you have to take the money from someone. It should be arguably more probable to have an edge against less sophisticated investors than against sophisticated professionals. Luckily for the individual trader there are some obvious ways to get out of the way of the most sophisticated professionals. Historically this blog focused on small, obscure stocks that provide opportunities that are not economical for the professional to exploit. Another way is to trade intraday, arguing that there is not enough liquidity in this timeframe for larger funds to employ similar strategies. I’m going to argue that the latter approach is more rewarding as it also allows for more frequent trades and thus more occurrences for the magic of compounding to do its thing.

Where does this rumination lead us? We need a system that generates many uncorrelated trading strategies, ideally trading very often. These strategies then are bundled with proper risk management into a portfolio. To his end I’ve developed a program that takes any data (price, fundamental, sentiment, satellite image data, etc.) and generates a trading strategy for a specified trading frequency. The core of this program is a recurrent neural network (RNN). More specifically, I use Long Short Term Memory (LSTM) units. LSTMs are a specific type of RNN that provide a solution to the vanishing gradient problem as shown by Hochreiter and Schmidhuber (1997). Basically, LSTM cells can look further into the past as traditional RNNs. LSTM networks are one important driver behind the recent advances in machine translation and speech recognition to give only two examples. For more examples read: http://karpathy.github.io/2015/05/21/rnn-effectiveness/.

As a test, I provided the framework only OHLC and datetime information for the EURUSD forex pair. The model extracted a Sharpe ratio of >5 and a CAGR of 60%. I’m the first one to point out that this is not an outcome you should expect to achieve in reality. But the model only gets price data, data that many believe has no predictive power whatsoever. For more information about this project refer to my Github page: https://github.com/jpwoeltjen.