Inspiration
Using neural networks for pattern recognition in real time signals showed promise for applications in predicting the changes in the seemingly chaotic stock market. If researched properly, this technology has the potential to circumvent the mutual fund, allowing users to maximize their return on investment and minimize their risk without needing to pay commission fees to investment firms.
What it does
The top level executable generates two trained neural networks. One, labeled "white lister," is designed to predict the change in a stock's market value from market open to close each day. This alone can help the user maximize their returns in long term investing strategies, as well as functionally "white listing" stocks that have a high likelihood of increasing over time, deeming them safer for day trading. The other network, labeled "daytrader," is designed to predict the change in a stock's market value from minute to minute. This allows the user to leverage the positive slopes of a stock's short time behavior to increase their return on investment even if a stock never appreciably increases.
How we built it
The training and evaluation data used to generate the models is acquired using Yahoo Finance's yfinance module. The neural networks are generated, trained and evaluated using Tensorflow's Keras module. The networks take in a feature vector extracted from a set time window of market values. The number of layers and size of each layer is made to be customizable, but the default topology is set to be seven hidden layers, with node counts of 300, 200, 100, 50, 25, 10, and 5 neurons going from input to output end. All networks are set to have three output classes, corresponding to inferences of "stock will increase," "stock will decrease," and "stock will not appreciably change." The definition of "appreciable change" is customizable by way of daily and per-minute deadgap values, taken as percentages of the current market value. The feature vector that is considered for the input consists of a small number of normalized recent market values, including the current value, a series of the changes in that market value over time, a discrete fourier transform of the considered market value window, and the mean and standard deviation of the considered window. All non-trivial calculations to attain these vectors are done using the NumPy API. The motivation for these features is that the frequency data and standard deviation will provide intuition for the market value's tendency to change quickly and dramatically, and the mean and time derivatives will provide context for how the current market value is already changing.
Challenges we ran into
The yfinance module only saves daily values from less recent times in the market history, so we decided to create two networks to classify long and short term changes as a way to get around the lack of training data. Classifying simply whether or not a price would increase at all was found to have no accuracy improvements with respect to training time at all, leading to the inclusion of the deadgap class.
Accomplishments that we're proud of
By tuning the deadgap and model parameters, the networks were able to achieve average accuracies of about 70% for riskier trades, and upwards of 90% for safer trades. Additionally, one of the team members, who was previously brand new to machine learning and relatively inexperienced with python was able to gain valuable programming experience, as well as design her first working neural network.
What we learned
The value of decision-making philosophy and information extraction processes in neural network design cannot be understated, as these tools were the deciding factor between a working model and near random levels of accuracy. Additionally, we were able to explore and practice python syntax and techniques, as well as the use of tensorflow, numpy and yfinance frameworks.
What's next for Machine Learning for Stock Price Prediction
Further development is needed to combine the efforts of the two neural networks to begin predicting stock prices in real time, as well as allow sets of networks to interact with one another to choose investments that are most likely to result in a positive outcome across a wide range of stocks
Log in or sign up for Devpost to join the conversation.