Context
Stocks and financial instrument trading is a lucrative proposition. Stock markets across the world facilitate such trades and thus wealth exchanges hands. Stock prices move up and down all the time and having ability to predict its movement has immense potential to make one rich.
Stock price prediction has kept people interested from a long time. There are hypothesis like the Efficient Market Hypothesis, which says that it is almost impossible to beat the market consistently and there are others which disagree with it.
There are a number of known approaches and new research going on to find the magic formula to make you rich. One of the traditional methods is the time series forecasting. Fundamental analysis is another method where numerous performance ratios are analyzed to assess a given stock. On the emerging front, there are neural networks, genetic algorithms, and ensembling techniques.
Another challenging problem in stock price prediction is Black Swan Event, unpredictable events that cause stock market turbulence. These are events that occur from time to time, are unpredictable and often come with little or no warning.
A black swan event is an event that is completely unexpected and cannot be predicted. Unexpected events are generally referred to as black swans when they have significant consequences, though an event with few consequences might also be a black swan event. It may or may not be possible to provide explanations for the occurrence after the fact – but not before. In complex systems, like economies, markets and weather systems, there are often several causes. After such an event, many of the explanations for its occurrence will be overly simplistic.
Content
Stock price prediction is the task of forecasting the future value of a given stock. Given the historical daily close price for S&P 500 Index, prepare and compare forecasting solutions. S&P 500 or Standard and Poor's 500 index is an index comprising of 500 stocks from different sectors of US economy and is an indicator of US equities. Other such indices are the Dow 30, NIFTY 50, Nikkei 225, etc.
For the purpose of understanding, we are utilizing S&P500 index, concepts, and knowledge can be applied to other stocks as well.
Dataset
The historical stock price information is also publicly available. For our current use case, we will utilize the pandas_datareader library to get the required S&P 500 index history using Yahoo Finance databases. We utilize the closing price information from the dataset available though other information such as opening price, adjusted closing price, etc., are also available.
We prepare a utility function get_raw_data() to extract required information in a pandas dataframe. The function takes index ticker name as input. For S&P 500 index, the ticker name is ^GSPC. The following snippet uses the utility function to get the required data.(See Simple LSTM Regression)
Features and Terminology:
In stock trading, the high and low refer to the maximum and minimum prices in a given time period. Open and close are the prices at which a stock began and ended trading in the same period. Volume is the total amount of trading activity. Adjusted values factor in corporate actions such as dividends, stock splits, and new share issuance.
Starter Kernel(s)
Acknowledgements
Mining and updating of this dateset will depend upon Yahoo Finance .
Inspiration
Sort of variation of sequence modeling and bleeding age e.g. attention can be applied for research and forecasting
Some Readings
If you download and find the data useful your upvote is an explicit feedback for future works