EM008 » Finance
This project will be developed for Rhumel SA, a small european fintech company aiming at assisting decision making in finance.
Throughout the last eleven years since the '08 crisis, the industry has been relying heavily on standard algorithmic approach as well as low interest rate for its development. But those two approaches have their limits.
Although the latter has helped to provide an apparent sluggish recovery, non conventional economic stimuli can't last forever as they tend to create bubbles. As for the algorithmic approach (HFT,indexes), the flash crash of 2010 has proven that under particular conditions, this technology hasn't helped improving market liquidity when most needed, quite the opposite. An average of 90% of trades placed by machines are canceled ...
Machine learning on the other hand, could help processing charts (graphic chart analysis on particular companies going back to the '70s) and help active investors process the information that really matters.
The intent of that project, would be to use the openVINO starter kit to implement a Convolution Neural Network (CNN) for candle stick charts (Open High Low Close or more commonly OHLC).
1) Machine learning for chart analysis:
First focusing on one company, say Intel for example, and going back to its introduction in the market, openVINO could be used to graphically analysis on candle stick charts and give sensible insight in other it is a good idea or not to invest in the stock. This very long term approach is radically different from what exist at the moment in the market.
2) OpenVINO and the state of the art:
Intel website already provides examples and articles concerning dealing with CNN. The idea here is to start from those examples (Alex Net image classification, the R-CNN demo) and implement a sequence of Convolution filter and Pooling filters in order to replicate the human chart analysis but on a much bigger scale.
The final aim of Rhumel is to help money flowing back to the real economy using modern tools and being pragmatic.
Thus, contributing in financing small businesses, avoiding bubbles, keeping governments and institutions out of debt.
In other words, contributing to have a sound economy again.
Patterns are recurring sequences found in "open-high-low-close" (OHLC) charts or candlestick charts which traders have historically used as buy and sell signals.
Several studies have found some correlation between patterns and future trends, although to a limited extent. The correlations were found to be between 50 and 60%, 50% being no better than random. Many active analyst are using chart patterns, sometimes combined with other techniques, to take their trading decisions, in a field known as "Technical Analysis", wich is different from high frequency trading (HFT).
Our goal is to automate the detection of these patterns and to evaluate how a Deep Learning based recognizer behaves. Automation would simplify the process of finding sequences which vary in scale and length. It would also help provide valuable information for stock market price prediction as these signals do offer small correlation with prices.
Alone, the patterns are not enough to predict trends, but may yield different results when coupled with other indicators.
Several types of detection algorithms exist: ranging from pragmatic to machine learning. The solutions vary in efficiency, re-usability and speed.
The solution we propose to implement is based on deep learning. Several ways exist to detect patterns in time series using neural networks. We will test a 1 dimensional and 2 dimensional Convolution Neural Network (CNN) applied to charts images. Here are some examples of pattern that could be detected by a CNN:
Example of bearish pattern:
This pattern is a bearish flag, where we can observe an initial drop from an extrema in the price
called a flagpole, followed by a high volatility, slow increase
in price called a flag and then followed by another flagpole of similar length to the first one.
This is typically associated with a downwards trend and has a rather distinctive look.
Example of double bottom pattern
This pattern for example, is analyzed as a "double bottom". It present two extremas separated by an
opposite local extrema. For this pattern, the peaks have equal or close values and the reversal between them is seen as a pullback value, which has to be crossed again in order to complete the pattern.
This pattern have been extensively analyzed and offer a profit:risk ratio of 1 with commonly accepted trading
strategies having been developed around it.
The core of the project consist in CNN which uses an iterative approach of extracting the features of an RGB image (convolution), filtering noise from usefull features (pooling) and then classification/organization of the extracted features which is implemented by the fully connected layers (FC).
The convolution operation extracts image features by computing the inner product of an input image matrix and a kernel matrix (the number of channels of the input image and kernel matrix are the same). For example, if the input image is an RGB color space, then the depth of the kernel matrix must be three; otherwise, the kernel matrix cannot capture the information between different color spaces.
The convolution filter studies successively every pixel of the image. For each of them, which is called the “initial pixel”, it multiplies the value of this pixel and values of the 3 surrounding pixels by the kernel corresponding value, or filtering marix if will (in the middle). Then it adds the results, and the initial pixel is set to this final result value.
This figure show, for example the value 10 = (4*0) + (2*1) + (8*1) + (4*0).
The 6 in the first row second column is obtained similarly by (0*2) + (1*2) + (1*4) + (0*0).
The purpose of that step is mainly edge enhancement of the charts.
The convolution layer often extracts a great number of features from the original image, and most of the features may be just noise, which could lead to model learning in the wrong direction. This is the so-called model over-fitting problem. In order to avoid that problem, classic CNN do down sampling of the pixels using the pooling technique.
We would use, to start with, the "max pooling" wich simply consist in taking the maximum value of the pixel and the three other pixels surrounding.
The Intel FPGA virtues this project will demonstrate are:
I) Boost performances
Doing that on a CPU would be just irrealistic. Alternatively, GPU processing could be envisaged but the architecture is just not set up for it. It is very good at making things parallel but there is no actual hardware CNN pipeline design onto it. As a result, the FPGA option is the best suited for that type of application
II) Adapts to changes
A CNN pipeline implementation might be good today, but be made irrelevant tomorrow. As a result it is necessary in this type of application to keep a certain degree of flexibility. Again, Intel FPGAs are great for that because of the CNN pipeline isn't fixed, since it will be implemented in Verilog, and can be updated at any point in time.