top of page

Cats and Dogs, Convolutional Neural Network for the Market.

In Ostirion we are developing machine learning and artificial intelligence models to gain an edge in the markets. The iconic deep learning architecture, the convolutional neural network, has not seen much application in the field as recurrent neural networks, the long-short term memory models for example, appear more suited for the time series prediction task.

This has not stopped scientists, or us, from trying. Some examples for these approaches can be seen here and here. Elaborating on these research papers, our question here at Ostirion is: can we separate a cat (bullish day) from a dog (bearish day) in a picture of the market?

We are using Quantconnect´s open source developement and back-testing engine for this.

The pictures of cats and dogs we have obtained so far are like these:

This is how a cat (True label, day close was above day open) and a dog (opposite behaviour) look like. The image contains information on both price and volume in 14 data channels. The image is truncated to the minute 360 to be used as signal during a normal market day.

So far the challenge has been obtaining a good, fast scaling from a pandas dataframe to a 2-D image contained in a numpy array:

scaled_data = pd.DataFrame(input_data.groupby(["Day",
"symbol"]).apply(lambda x:minmax_scale(x.astype(float),feature_range=(-1, 1) )))

So far, apply function over minmax_scale (not minmax_scaler) from sklearn kit has led to the fastest and most useful results. The image can be made more human readable using robustscaler, as the maximum and minimum for traded volume values (outlier on open and on close) distort the "color" of the channel. In any case no dog or cat will be discernible to the human eye...

Stay tuned for more progress on this application of a convolutional neural network to the stock market. If you are interested on investing with us or require technical consulting in financial markets research and development contact us here.

63 views0 comments

Recent Posts

See All


bottom of page