Stock Price Prediction using Facebook Prophet

. Estimating stock prices has always been a challenging task for researchers in the financial sector. Although the Efficient Market Hypothesis states that it is impossible to accurately predict stock prices, there is work in the literature that has shown that stock price movements can be predicted with the right level of accuracy, if the right variables are selected and appropriate predictor models are developed. those that are flexible. The Stock Market is volatile in nature and the prediction of the same is a cumbersome task. Stock prices depend upon not only economic factors, but they relate to various physical, psychological, rational and other important parameters. In this research work, the stock prices are predicted using Facebook Prophet. Stock price predictive models have been developed and run-on published stock data acquired from Yahoo Finance. Prophet is capable of generating daily, weekly and yearly seasonality along with holiday effects, by implementing regression models. The experimental results lead to the conclusion that Facebook Prophet can be used to predict stock prices for a long period of time with reasonable accuracy.


INTRODUCTION
Proper stock forecasting can lead to great profits for both the investor & the trader. Often, it proves that forecasting is more complex than random, which means that it can be predicted by cautiously analysing the history of the relevant stock market. ML is an effective way to represent such an operation. It predicts market value close to carrying value, thereby raising accuracy. Introduction of ML in the stock market has demanded a lot of research since the efficient and precise measurements. An important part of ML is the data taken. Databases should be as tangible as possible because small changes in data can further drastic changes in results. In this project, supervised ML is based on a database gained from Yahoo Finance. This database contains the following 5 variants: open, closed, low, high and volume. Open, closed, low & high are different stock bid prices at different times with almost specific names. Volume is the no. of shares passed from 1 owner to different over a period of time. The model was then tried on sample data.
Stock market is specified as non-linear, fluctuating and unpredictable in nature. Predicting stock prices is a demanding task as it depends on different factors including but not limited to political atmosphere, world economy, company's financial conditions and performance etc. Hence to maximise the profit and minimise the loss, technique to predict the amount of the stock in advance by analysing the trends over the last some years, could prove to be extremely useful for stock market prediction.
The most important motivation for attempting to predict the stock market prices is financial earning. The capability to uncover a mathematical model that can predict the path of the future stock prices will make the owner of the model very rich. Thus, researchers, investors and brokers are always trying to find stock market models that would give them better returns than their counterparts.

Related Work
There are multiple systems existing to provide a solution to the above problem. The existing systems indeed help us to come to a conclusion, but that is not the final outcome in the current situation. The conclusion from the above problem should be accurate enough to predict the decision. The judgement is very sensitive and hence it needs to be very precise. Below is the list of the existing systems that have been researched, the methodologies and the parameters they had taken into consideration as in table 1.

Limitations of Existing System
The existing systems like lstm, arima doesn't work well on robust data or inconsistent data so predictions are hard .They are suitable for short term only • Increase in noise variation makes prediction worse .Existing systems doesn't work well with traditional and seasonal trend present in data

Proposed Methodology
To have the completion of the proposed work, a proper methodology is supposed to be followed. Firstly, the dataset needs to be fetched and cleaned which can then be used for training purposes.

Fig. 1 Proposed System
The first step is to collect data from Yahoo finance. Then taking appropriate input parameters in consideration. After this, deciding the features for predictions is done. Finally using facebook prophet the predictions are made and plotted on the graph

Dataset
Downloading a set of data from Yahoo finance.Yahoo! Finance is the media asset which is a member of Yahoo! network. Provides financial information, data and comments including stock quote, media release, financial details, and actual material.

Parameter
The stock closing price has been chosen as our parameter. Whatever move the stock makes throughout the day due to volatility in the end the closing price is something of utmost importance. The closing stock price is remarkable for many reasons. Investors, traders, financial institutions, regulators and other stakeholders use it as a reference place for calculating performance over a particular time such as a year, a week and over a smaller time frame such as 1 minute or less. In fact, investors and stakeholders make their settlement on closing stock prices. Institutional investors check stock's closing price to make decisions in their investment assets. Hence the close price is our target attribute used for predictions.

Facebook Prophet
Prophet is a process of predicting time series data derived from add-on models where nonlinear trends correspond to seasonal, weekly, and daily periods, as well as holiday outcomes. It works best with a series of time periods with strong seasonal results and a few seasons of historical data. The prophet is strong on lost data & shifts in trend, and often treats outsiders. The prophet makes it clearer to make a more accurate forecast that is very fast compared to other time series forecast strategies. This model requires very little calculation time compared to other models. The prophet is equal to the models in Stan to get predictions in a few seconds. It allows us to get accurate weather forecasts with dirty data without any manual effort. The Prophet has numerous "human" seasons of the week and time of year.

IMPLEMENTATION AND RESULTS
This section contains implementation and results of all the features used in the proposed system. Yahoo finance has been used to collect data for the last 20 years i.e. from 1 jan 2000 to current date to forecast the predicted price for the next five years using facebook prophet. Streamlit framework has been used for this work as it is very easy to use and has several features in it and helps to make an interactive application. The period for prediction is taken as 5 years. The dataset is trained using the prophet fit function. In prophet it is required to rename the major columns to ds and y. The Date column is taken as 'ds' and the 'Close' column as y and hence predicted the future prices and plotted them on the graph.

Fig. 1 Proposed System
The first step is to collect data from Yahoo finance. Then taking appropriate input parameters in consideration. After this, deciding the features for predictions is done. Finally using facebook prophet the predictions are made and plotted on the graph

Fig 2. Graph before predictions
In Fig 2 On X-axis the closing price of stock is taken and On Y-axis Time (years) is taken. Graph is plotted for the closing price of HDFC Bank from 1 Jan,2000 to the current date.

Fig 3. Graph after Predictions
In fig 3 On X-axis the closing price of stock is taken and On Y-axis Time (years) is taken. Graph is plotted for the closing price of HDFC Bank from the 1 Jan,2000 and also the predictions for the next five years represented by the blue line.

5.Conclusion
System is designed for predictions of the future prices of stocks for next 5 years using Facebook Prophet that can be used for better investments. This makes it easy to determine which stock to choose for investment based on the predictions giving the highest percentage of returns in a given period of time.The prediction accuracy can be increased by using several other features of Facebook Prophet and also make the application interactive and easy to use. In future, the stock market prediction system can be further increased by utilising a larger dataset than one being used presently. This will help to rise the accuracy of prediction models