This is the first in a multi-part series where we explore and compare various deep learning trading tools and techniques for market forecasting using Keras and TensorFlow. In this post, we introduce Keras and discuss some of the major obstacles to using deep learning techniques in trading systems, including a warning about attempting to extract meaningful signals from historical market data. Deep Learning for Trading: Part 2 provides a walk-through of setting up Keras and Tensorflow for R using either the default CPU-based configuration, or the more complex and involved (but well worth it) GPU-based configuration under the Windows environment.
In the last few years, deep learning has gone from being an interesting but impractical academic pursuit to a ubiquitous technology that touches many aspects of our lives on a daily basis – including in the world of trading. This meteoric rise has been fuelled by a perfect storm of:
- Frequent breakthroughs in deep learning trading research which regularly provide better tools for training deep neural networks
- An explosion in the quantity and availability of data
- The availability of cheap and plentiful compute power
- The rise of open-source deep learning tools that facilitate both the practical application of the technology and innovative research that drives the field ever forward
You were unknowingly drawing neural networks as a kid…
Deep Learning for Trading? Not so fast…
However, as anyone who has used deep learning in trading can attest, the problem is not nearly as simple as just feeding some market data to an algorithm and using the predictions to make trading decisions. Some of the common issues that need to be solved include:- Working out a sensible way to frame the forecasting problem, for example as a classification or regression problem.
- Scaling data in a way that facilitates the training of the deep network.
- Deciding on appropriate network architecture.
- Tuning the hyperparameters of the network and optimization algorithm such that the network converges sensibly and efficiently. Depending on the architecture chosen, there might be a couple of dozen hyperparameters that affect the model, which can provide a significant headache.
- Coming up with a cost function that is applicable to the problem.
- Dealing with the problem of an ever-changing market. Market data tends to be non-stationary, which means that a network trained on historical data might very well prove useless when used with future data.
- There may be very little signal in historical market data with respect to the future direction of the market. This makes sense intuitively if you consider that the market is impacted by more than just its historical price and volume. Further, pretty much everyone who trades a particular market will be looking at its historical data and using it in some way to inform their trading decisions. That means that market data alone may not give an individual much of a unique edge.
Said differently, feeding market data to a machine learning algorithm is only useful to the extent that the past is a predictor of the future. And we all know what they say about past performance and future returns.In deep learning trading systems that I’ve taken to market, I’ve always used additional data. Not just historical, regularly sampled price and volume data and transformations thereof. While there does appear to be a slim edge in using deep learning to extract signals from past market data, that edge may not be significant enough to overcome transaction costs. And even if it does, it may not be significant enough to justify the risk and effort required to take it to market. On the other hand, supplementing historical market data with innovative, uncommon data sets has proven more effective – at least in my experience. 2 In this series of posts, we explore and compare various deep learning trading tools and techniques in relation to market forecasting using the Keras package. We will do so using only historical market data, so the results need to be interpreted considering the discussion above. We expect deep learning to uncover a slim edge using historical market data, but the purpose of this analysis is to compare different deep learning tools in relation to market forecasting, not necessarily to build a market-beating trading system. That I leave to you – perhaps you can supplement the models we explore here with some creative or uncommon data or other tools to find a real edge.



Hi
Yann LeCun said ” Generative adversarial networks ( GANs )most interesting idea in the last 10 years” .Ian Goodfellow the creator of GANs said something like GANs are better than neural networks trained by monte carlo markov chains models . Are they suiatable for trading ?Do you have any experience with them?
I do have experience with GANs, but not in relation to trading. A GAN essentially consists of two networks, one which generates artificial samples from the real samples with the goal of tricking the other network into classifying a fake sample as a real one. The theory is that as training progresses, the generative network learns to produce more and more realistic samples, while the classifying network gets better and better at spotting fakes. There might be an application to market forecasting, but it doesn’t immediately jump out at me. Further, GANs are notoriously difficult to tune and I shudder to think of the effort required to get them to behave nicely on market data!
Also, I believe LeCunn’s comments are three or four years old now, and the field has come a very long way since then!
Finally, a question for you – what makes a neural network trained using MCMC “good”? That seems a long and convoluted way to find a good set of weights when gradient descent and it’s variations usually work just fine!
For anyone who tried to download the code and data and encountered the broken link, it has now been fixed. Enjoy!