Stock Price Predictions
Total Page:16
File Type:pdf, Size:1020Kb
Stock Price Predictions An Interactive Qualifying Project submitted to the Faculty of WORCESTER POLYTECHNIC INSTITUTE in partial fulfilment of the requirements for the degree of Bachelor of Science by Chang Liu Date: July 19, 2019 Report Submitted to: Professor Mayer Humi, PhD Worcester Polytechnic Institute This report represents work of WPI undergraduate students submitted to the faculty as evidence of a degree requirement. WPI routinely publishes these reports on its web site without editorial or peer review. For more information about the projects program at WPI, see http://www.wpi.edu/Academics/Projects. Abstract The objective of this project was to predict stock prices over a short period of time, possibly several weeks. First, we chose 10 stocks of interest in the same sector. To make informed predictions, we built several models for the historical prices of the stocks and used those models to predict future prices. Then, we analyzed the results of those models to improve the predictions. In addition, a portfolio of the 10 stocks was created to measure their performance. 1 Table of Contents Abstract ........................................................................................................................................... 1 Executive Summary ....................................................................................................................... 3 Introduction .................................................................................................................................... 5 Background .................................................................................................................................... 7 Stock 1: Microsoft Corporation (NASDAQ: MSFT) ........................................................................... 7 Stock 2: Apple, Inc. (NASDAQ: AAPL)................................................................................................ 8 Stock 3: Facebook, Inc. (NASDAQ: FB) ............................................................................................... 8 Stock 4: Intel Corporation (NASDAQ: INTC) ..................................................................................... 9 Stock 5: Oracle Corporation (NYSE: ORCL) .................................................................................... 10 Stock 6: QUALCOMM, Inc. (NASDAQ: QCOM) ............................................................................. 11 Stock 7: NVIDIA Corporation (NASDAQ: NVDA) ........................................................................... 11 Stock 8: Dell Technologies, Inc. (NYSE: DELL) ................................................................................ 12 Stock 9: Baidu, Inc. (NASDAQ: BIDU) .............................................................................................. 13 Stock 10: Advanced Micro Devices, Inc. (NASDAQ: AMD) ............................................................. 13 Methodology ................................................................................................................................. 15 Autocorrelation Model .......................................................................................................................... 15 Trend Model .......................................................................................................................................... 16 Fourier Series Model ............................................................................................................................. 17 Fourier Series Correlated with Stock Index Model ........................................................................... 18 Virtual Portfolio .................................................................................................................................... 20 Results........................................................................................................................................... 21 Autocorrelation Model .......................................................................................................................... 21 Trend Model .......................................................................................................................................... 26 Fourier Series Model ............................................................................................................................. 31 Fourier Series Correlated with Stock Index Model ........................................................................... 37 Virtual Portfolio .................................................................................................................................... 43 Conclusion .................................................................................................................................... 44 Bibliography ................................................................................................................................. 45 2 Executive Summary The project began with choosing a sector of stocks to concentrate on. We chose the technology sector because stocks in this sector had been growing rapidly since the dotcom bubble. Many small companies, such as Facebook and Amazon became technology giants in the last decade. The 5 most weighted Nasdaq 100 Index companies were all in the tech sector. If we chose stocks in this sector, we would be very likely to earn high profits from our investments. Next, we chose 10 mid-range stocks in the technology sector. The stocks chosen needed to be trading between $20 and $200 so that they were accessible to relatively small investors. As of 6/21/19, the Google stock was trading over $1000. Even one share of such a stock might be too expensive to buy for investors with little capital. Also, if a stock was trading too low, there might be a risk for the stock price to drop dramatically or even exit the market. Therefore, mid- priced stocks were the most appropriate for small investors. After choosing 10 stocks, we started to build models for the stock prices. The first step was to determine for how long the historical prices were relevant to today’s stock prices. We calculated the autocorrelation coefficient of the stock prices over the past two years and found the period where the autocorrelation coefficient was greater than zero. The length of this period might vary from stock to stock but was usually several months. Then we developed three models to fit the historical prices of the stocks. The three models were the Trend Model, the Fourier Series Model, and the Fourier Series Correlated with Stock Index Model. After each model was developed, we tried to extend the model to the future and evaluated how well the model 3 performed as time passed. In the meantime, we also created a virtual portfolio to demonstrate that we were able to make some profits throughout this project. 4 Introduction To many average people, investing in the stock market is one of their best ways to make investments. Unlike other forms of investments, stocks have very high liquidity. A real estate can take months to be sold, but stocks can be traded instantly for cash, which is considered to be of the highest liquidity. Stocks also support flexible trading, which allows investors to quickly make adjustments to market fluctuations. Bonds like fixed deposits, on the other hand, can only be redeemed after the fixed date. If the interest rate goes up before the bonds are due, investors cannot sell them for more interests. In fact, trading stocks is so convenient today that people can utilize computer programs to make transactions automatically. Many online brokers offer investors the option to buy or sell a stock when certain conditions happen. This project mainly focused on the U.S. stock market, as it is the largest stock market in the world. Both the Nasdaq Stock Market and the New York Stock Exchange have a variety of stocks for us to choose. Also, since the U.S. Dollar is the most widely available and accepted currency in the world, trading stocks in U.S. Dollar is very friendly to international investors. This project aimed to benefit small investors the most. While large financial institutions often had lots of computing resources like central servers to trade stocks automatically at a very high frequency, models developed in this project could be easily implemented on a personal computer running MATLAB (MATLAB, n.d.). The methods were designed so that they could be easily modified to fit an investor’s own choice of stocks. In addition, since the stocks of choice were priced moderately, no significant amount of investments was required. The stocks we chose were all from big companies and were relatively immune to market fluctuations. This meant that we were unlikely to see dramatic stock price drops. Also, this project assumed very little 5 background knowledge from the audience, as any necessary technical term would be thoroughly explained in later sections. Last but not least, the functions used in our code were all from common MATLAB libraries, so the users did not need to purchase additional software packages. 6 Background There were more than 5,000 stocks trading in the U.S. stock market, so we needed to choose a sector to narrow our focus. We chose the technology sector because the U.S. was leading in many areas such as Electrical Engineering and Computer Science. Almost all the technology giants were based in the Silicon Valley in the U.S. and their stocks had been growing generally faster than