Due to inherent volatility in the equity markets, investors find themselves struggling to make significant profit. Nonetheless, many investors are hesitant about exploiting these drastic changes to generate profit and could potentially see their assets depreciating in value due to such volatility while investing in the short-term. As a result, new investors are afraid to participate in short-term investment. However, such downside risks posed by volatility can be mitigated through the use of efficient stock screening software in order to expand a portfolio’s income.

What it does

This team has proposed a solution that will introduce investors to the possibilities of short term investment while also educating them on the variety of data that is factored in when analyzing a stock. The software recommends which stocks investors should add to their portfolios based on technical indicators and suggests limit buy/sell prices. The software will amass news articles and online conversations regarding a certain stock and perform a sentiment analysis to determine general investor sentiment rating. Additionally, each stock’s volatility, volume, and 10-day trend are also factored into determining the overall rating. Volatility is calculated by averaging the percent changes of each day, and the trend is computed by summing these values up. A volume rating is also calculated out of a 100 using a logistic curve formula. This allows for low-volume stocks to receive a negligible rating while capping out high-volume stacks at a maximum. Overall, a combination of different weighting of the factors result in a stock rating. The threshold for the rating is set at 40 before the stock bot recommends it. This threshold and the weighting for the various data was determined by analyzing a multitude of stocks and using well-known values in the trading industry.

In order to determine suggestions for buying and selling prices, the range of prices where the stock value was in most frequently was calculated. The lower value is the buying price, and the higher value is the selling price. Minor adjustments were made in the lower and higher values in order to account for uncertainty.

In addition, the software will render a candle chart of the stock suggested by the software and also provides the user with a forecast table that will predict stock prices over the short term. Based on the standard deviation of the last 10-20 stock prices, the program will forecast values, mirroring volatility in the stock’s price.

How we built it

The back-end of the web-app is a series of Python functions which collects and analyze stock data. The data is collected from Yahoo Finance using the yahoo_fin module which is able to return pertinent data about specific tickers. Sentiment analysis is also performed on both the conversations and press releases of a stock on the Yahoo Finance page. The front-end of the web app utilizes HTML, CSS, jQuery, and Flask to display the information to the user in an organized fashion. The Flask code calls certain functions in the program’s back-end dependent on the requests sent from our HTML files. The requests are sent using the jQuery JavaScript library, embedded as scripts within the HTML files. Additional information related to a stock is displayed using Bootstrap which created modals (popup displays with content) when a suggested ticker is clicked. In addition, a Least Recently Used (LRU) caching scheme for Python in the functools module is implemented in the program. This enables the returned values of certain functions to be held in computer memory so that another call with the same conditions will immediately return the previous value. Doing so considerably decreases operation and processing time and improves overall functionality of the software dramatically.

The graphs are generated using the "quantmod" package found in the R language. Initially, the program uses the getSymbols() function to extract data from an online source — in this case, Yahoo Finance. The program also adjusts for weekends since the stock market is closed on both Saturday and Sunday. Also, using the plot() function, the data is plotted on a standard graph and displayed to the user. The forecasting tables that are displayed to the user are also generated using R.

What's next for StockDock

In the future, neural networks can be trained to study historical stock data and make better suggestions for stocks to invest in the short term.

Share this project: