SMAP - A Stock Market Analysis and Prediction Web Application

. The Stock Market is one of the most rapidly emerging markets in the country as the participation of retail investors has increased signiﬁcantly in this pandemic.Since there are no speciﬁc rules to compute or predict the price of a stock, it becomes very di ﬃ cult for the ﬁrst-time investors to invest in the share market. Methodologies such as technical analysis, fundamental analysis, time series analysis, and statistical analysis, etc. are all used to estimate the price of the stocks but since stocks being volatile in nature, none of these methods are proved as a consistent tool to predict the upcoming trends. Machine learning and statistics can be used to predict and reduce the risk factor of loosing money. Apart from predicting future price trends based on the historical data of the company, the web app also show’s various decision making factors and fundamental indicators for providing multiple options to users for consideration while making a call. With the help of statistical analysis, the relation between the selected factors and share price is formulated for computing better results. Using facebook Prophet without any hyperparameter’s forecast for particular stocks are made. These result’s are evaluated by comparing with other models like Last value and prophet with hyperparameter tuning.


Introduction
Foreseeing how the financial exchange will perform is quite possibly the most troublesome thing to do. There are such countless elements engaged with the forecast -actual variables versus mental, reasonable and nonsensical conduct etc.Taking factors viable like the most recent declarations about an association, their quarterly income results, and so forth, AI strategies can possibly uncover examples and bits of knowledge we didn't see previously, and these can be utilized to make unerringly precise expectations. In this undertaking, SMAP will perform qualitative analysis on stocks of di↵erent companies, their valuation over a period of time along with the sales volume and on that basis, it will predict the risk we put in investing those companies along with the prediction of future stock trends. With the help of a web-based approach, all these information will be available on a website along with other additional information for making better decision while investing in the shares of that particular.

Literature Survey
Existing systems were based on particular algorithms such as Artificial Neural Network, Support Vector Machine, Time Series Linear Mode and Hidden Markov Model. It is good for performance, optimization and efficient but failed to provide Real -Time Accuracy [3]. In Hidden Markov ⇤ e-mail: ninadpatil1452@gmail.com ⇤⇤ e-mail: rajmuta1684@gmail.com ⇤⇤⇤ e-mail: pandeyveer45@gmail.com ⇤⇤⇤⇤ e-mail: rohanppp1232@gmail.com Model the advantage of this model is that it uses for optimization purposes. But the model is not able to evaluate, decode and learn from the present data-set [3]. It uses technical indicators as its parameters. Artificial neural network being the main technique in projects. It provided the model with advantages like Better performance compared to regression and lower prediction errors for small noise variation. But as the noise variation increases the prediction got worse. This proves to be the disadvantage of the model [1]. The model where the real information is incorporate to the best straight model. As the customary and occasional patterns came into information, the forecast rate fell down [8]. Model which utilized far reaching profound learning framework it is seen that it didn't lose a lot of exactness when applied to an example from outside the preparation test. Yet, overstate to minor changes in the preparation information which decline the prescient capacity. The parameter used in this model is Consumer investment, net revenue, net income, price per earnings ratio of stock, consumer spending [9]. The ARIMA (Autoregressive Integrated Moving Average) model is one of the most robust and efficient models in our study. But the disadvantage with it is that it is suitable for only short term use [10]. Systems which used supervised machine learning had advantage that previous time points to the input layer contain inputs. Disadvantage is that it is possible to feed those words in through a much smaller set of input nodes [5].

Problem Statement
Stock market appears in the news every day. This pandemic has made people realize that just saving money is not enough but investing it can only help in beating inflation. As the number of Demat accounts opened has increased, the rate of investment and business opportunities in the Stock market has increased. If a portal/web application is developed which can predict the short-term price of an individual stock, it can be very helpful for the firsttime investors in their investing journey. Existing solutions on the above scenario have either a web interface with all the stock information or there's prediction made on future stock trends on limited companies with no other information about the stock. To eradicate the problems discussed above, a web app is developed with users having the liberty to choose any stock for detailed analysis with stock price trends and other fundamental indicators of that particular stock. The reason behind using Prophet model is that it doesn't require a lot of knowledge or experience forecasting. It performs better compared to others in majority of cases. The forecast is faster as it fits models in stan.

Proposed Methodology
With the help of Flask which is a web-framework of python ,which deploy our model for predicting real-time future trends [11]. It provides the web interface which we used to create the web application. The data of the stocks which SMAP uses for the prediction is provided by YAHOO Finance API. Integration of YAHOO Finance API is done for historical data along with other corporate actions and fundamental indicators. The data set is further trained and predicted using a Additive model which is a nonparametric regression method. This methodology is provided by the FB Prophet model [7]. A forecast is generated for the predicted price of the stock which is further plotted using a python library know as Plotly.
As shown in the generalized flow of the system figure 1 here the user selects his/her required stock. The application fetches the data from YAHOO finance and further using the model the predictions are made. The user is later able to see the graph of the future prediction.
In the core of Prophet which is an additive regression which has four main components: • Logistic or linear piecewise growth curve trend. By selecting change points from the data prophet easily detects changes in the trend. • A yearly seasonal component modeled using Fourier series. • A weekly season component using dummy variables.
• A user-provided list of important holidays.
Prophet will provide a components plot which graphically describes the model it has fit as show in Figure 2 • Data is fetched using the Yahoo Finance API. The Adjacent closing values is used by the model for the forecasting purpose.
• FBProphet train's using given data. Further using additive model it fits the non-linear trends and gives the forecast. • The given forecast and plotting data is given to the Plotly library which is used to plot the graph for visual perspective. • The non-linear trends which are fit with daily, yearly and monthly e↵ects are shown in Figure 2

Implementation and Results
The prophet is integrated to a web application using Streamlit. Streamlit is a app framework which is open source. With the use of the API it automatically updates in the source file [11]. The data is collected for every stock using Yahoo finance API. Every stock is provided with a unique Ticker which is used to refer the company in the database. Using the download method which is provided with fields like the ticker, start and current date, the data is downloaded [7]. A sample input of data is shown in table 1 For the proposed application Facebook prophet is the basic block for prediction. Though there are many methods for predicting the stock price and trend, it was decided to used Facebook prophet model as it is able to generate prediction of a good quality and at scale. Prophet, is a open-source software which is developed by Meta data Science team. It is based on additive model where non-linear trends are fit with yearly, weekly and daily e↵ects. It performs best when it has a large amount of historical data. It overcomes missing data and shift in trends problems [12]. In this application prophet tool is used for the prediction purpose. The user selects the amount of data to be fetched from the API and feed it into the model. Based on the input data, the model trains the dataset and forecast is done. An example of using Facebook's prophet tool to predicting the price of APPL stock is shown in Figure 3 for next year [1].
To check the e↵ectiveness of the method used, we used the root mean square error (RMSE), mean absolute percentage error (MAPE), and mean absolute error (MAE) metrics. For any metrics, the lower the value the better the prediction.
The MAPE is use to calucalte the overall accuracy of the forecast and it's equation is given as:  Root mean square mistake is perhaps the most usually involved measure for assessing the nature of forecasts. It shows how far expectations tumble from estimated genuine qualities utilizing Euclidean distance.
The average of all errors is Mean absolute error. It's equation is given as: The last value method is used as a benchmark in many models. The prediction are set as last observed value. The current adjusted closing price are set as the previous day's adjusted closing price. We would be compared this methods with prophet which we have used in our paper. In SMAP, the data has been taken of 3 years and based on that produced a forecast for 1 year. The forecast gives a RMSE of 1.89, MAPE of 1.59% and MAE of 1.80 [7]. The results are summerised in Table 2: From the summery of Table 2 it is found out that using various hyperparameters the reduction in error is not consistent. Prophet without any hyperparameters shows a stable result but has higher values than last value model. From the performance Bar Graph in Figure 4 prophet without tuning has close values in all the three parameters with Last value. For window size who's optimum value came as None has a significant high value when compared with Last value. Fourier order is also high when compared to Last value from the Figure 4

Conclusion
The application introduced a way for the user to predict the price of a particular stock with ease. The user was able to select the particular stock and generate the required forecast. Thus, Based on real-time analysis, future stock trends will be predicted on the top historical data of that company. To enhance user experience, we have followed a web-based approach, where the user can go through the insights of the stocks along with the future trend prediction and other decisive factors based on real-time analysis. The prophet model was not able to surpass the last value method in terms of performance. When hyperparameters were implemented within the Prophet model, in some instances it gave a better result than the last value but it was inconsistent. Overall prophet without any hyperparameters results are comparable with that of last value.