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: Corporation (: MSFT) ...... 7 Stock 2: Apple, Inc. (NASDAQ: AAPL)...... 8 Stock 3: Facebook, Inc. (NASDAQ: FB) ...... 8 Stock 4: Corporation (NASDAQ: INTC) ...... 9 Stock 5: (NYSE: ORCL) ...... 10 Stock 6: , Inc. (NASDAQ: QCOM) ...... 11 Stock 7: Corporation (NASDAQ: NVDA) ...... 11 Stock 8: Technologies, Inc. (NYSE: DELL) ...... 12 Stock 9: , Inc. (NASDAQ: BIDU) ...... 13 Stock 10: , 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 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 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 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 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 and Computer Science. Almost all the technology giants were based in the in the U.S. and their stocks had been growing generally faster than stocks in other sectors like the finance sector. Also, many stocks in this sector were components of the NASDAQ Composite Index and thus were a good representation of the overall stock market. If our models predicted these stocks accurately, they could be used on other stocks and be very applicable as well.

Stock 1: Microsoft Corporation (NASDAQ: MSFT)

Microsoft Corporation, incorporated on September 22, 1993, is a .

The Company develops, licenses, and supports a range of software products, services and devices. The Company's products include operating systems; cross-device productivity applications; applications; business solution applications; desktop and server management tools; software development tools; games, and training and certification of computer system integrators and developers. It also designs, manufactures, and sells devices, including personal , tablets, gaming and entertainment consoles, phones, other intelligent devices, and related accessories, that integrate with its cloud-based offerings. It offers an array of services, including cloud-based solutions that provide customers with software, services, platforms, and content, and it provides solution support and consulting services. It also delivers to a global audience (Microsoft Corp Company Profile, n.d.).

7

I chose this company because it was included in Nasdaq 100 and S&P 500. Its desktop , Windows had a market share of more than 80%. Microsoft Corporation had a market cap of more than $950B as of May 2019, which was the greatest among all publicly traded companies.

Stock 2: Apple, Inc. (NASDAQ: AAPL)

Apple, Inc., incorporated on January 3, 1977, designs, manufactures and markets mobile communication and media devices, personal computers and portable digital music players. The

Company sells a range of related software, services, accessories, networking solutions and third- party digital content and applications. The Company's products and services include iPhone, iPad, Mac, iPod, Apple Watch, Apple TV, a portfolio of consumer and professional software applications, iOS, macOS and watchOS operating systems, iCloud, Apple Pay and a range of accessory, service and support offerings (Apple Inc Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. Its main product, iPhone had a market share of more than 70% in the premium smartphone market.

Apple, Inc. was also the most profitable tech company in 2018.

Stock 3: Facebook, Inc. (NASDAQ: FB)

Facebook, Inc., incorporated on July 29, 2004, is focused on building products that enable people to connect and share through mobile devices, personal computers and other

8 surfaces. The Company also enables people to discover and learn about what is going on in the world around them, enables people to share their opinions, ideas, photos and , and other activities with audiences ranging from their friends to the public, and stay connected by accessing its products. The Company's products include Facebook, Instagram, Messenger,

WhatsApp and Oculus. The Company also engages in selling advertising placements to marketers. Its advertisements let marketers reach people based on a range of factors, including age, gender, location, interests and behaviors. Marketers purchase advertisements that can appear in multiple places, including on Facebook, Instagram, and third-party applications and Websites

(Facebook Inc Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. Its main product, Facebook was the most used social media worldwide; Instagram, which was owned by

Facebook was the most popular photo and video-sharing social media around the world.

Stock 4: Intel Corporation (NASDAQ: INTC)

Intel Corporation, incorporated on March 1, 1989, is engaged in designing and manufacturing products and technologies, such as the cloud. The Company delivers computer, networking and communications platforms to a set of customers, including original equipment manufacturers (OEMs), original design manufacturers (ODMs), cloud and communications service providers, as well as industrial, communications and automotive equipment manufacturers. It offers platforms to integrate various components and technologies, including a and , a stand-alone System-on-Chip (SoC), or a multichip package. Its

9 platforms are managed by additional hardware, software and services offered by Intel (Intel Corp

Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. It had a market cap of more than $200B as of May 2019. Intel Corporation was the largest computer microprocessor manufacturer in the world.

Stock 5: Oracle Corporation (NYSE: ORCL)

Oracle Corporation, incorporated on October 9, 2005, provides products and services that address all aspects of corporate information technology (IT) environments, including application, platform and infrastructure. The Company's businesses include cloud and on-premise software, hardware and services. Its cloud and on-premise software business consist of three segments, including cloud software and on-premise software, which includes Software as a Service (SaaS) and Platform as a Service (PaaS) offerings, cloud infrastructure as a service (IaaS) and software license updates and product support. The company’s hardware business consists of two segments, including hardware products and hardware support. Its services business includes activities, such as consulting services, enhanced support services and education services, among others (Oracle Corp Company Profile, n.d.).

I chose this company because it was included in S&P 500. It had a market cap of more than $180B as of May 2019. It was the third most profitable software company in the world.

10 Stock 6: QUALCOMM, Inc. (NASDAQ: QCOM)

QUALCOMM, Inc., incorporated on August 15, 1991, is engaged in the development and commercialization of a digital communication technology called code division multiple access (CDMA). The Company is engaged in the development and commercialization of the orthogonal frequency division multiple access (OFDMA) family of technologies, including long- term evolution (LTE) for cellular wireless communication applications. The Company also develops and commercializes a range of other technologies used in handsets and tablets that contribute to end user demand, such as certain audio and video codecs, the wireless local area networks (WLAN) 802.11 functionality and volatile and non-volatile memory controllers. Other technologies used by wireless devices that it has developed include operating systems, user interfaces, graphics and camera processing functionality, packaging techniques, sensors and sensor fusion algorithms and application processor architectures (Qualcomm Inc

Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. It had a market cap of more than $90B as of May 2019. Qualcomm, Inc. was the largest smartphone application processor manufacturer in the world.

Stock 7: NVIDIA Corporation (NASDAQ: NVDA)

Nvidia Corporation, incorporated on February 24, 1998, focuses on personal computer

(PC) graphics, (GPU) and also on (AI). The

Company provides service to its customers through PC, mobile and cloud architectures. The

11 Company's processor has created platforms that address four markets: Gaming, Professional

Visualization, Datacenter, and Automotive. The Company's GPU product brands are aimed at specialized markets, including GeForce for gamers; for designers; Tesla and DGX for AI data scientists and big data researchers, and GRID for cloud-based visual computing users. The

Company's brand integrates an entire computer onto a single chip and incorporates GPUs and multi-core central processing units (CPUs) to drive supercomputing for mobile gaming and entertainment devices, as well as autonomous robots, drones and cars. NVIDIA has evolved the

GPU into a computer brain at the intersection of virtual reality, high performance computing, or high-performance computing (HPC) and artificial intelligence (Nvidia Corp Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. It had a market cap of more than $90B as of May 2019. Nvidia Corporation was the world’s largest computer GPU manufacturer.

Stock 8: Dell Technologies, Inc. (NYSE: DELL)

Dell Technologies, Inc., formerly Denali Holding Inc., incorporated on January 31, 2013, is a provider of information technology (IT) solutions. The Company designs, develops, manufactures, markets, sells and supports a range of products and services. It also offers cloud- enabled data analytics and infrastructure management solutions and services. The Company offers or arranges various financing options and services for its business and consumer customers in the , Canada, Europe, and Mexico through Dell Financial Services and its affiliates (DFS). The activities of DFS include the origination, collection and servicing of

12 customer receivables related to the purchase of the Company's products and services. The

Company has global presence across the Americas, Europe, Middle East, Asia and other geographic regions (Dell Technologies Inc Company Profile, n.d.).

I chose this company because it had a market cap of more than $45B as of May 2019.

Dell Technologies, Inc. was the 35th most profitable company in the United States.

Stock 9: Baidu, Inc. (NASDAQ: BIDU)

Baidu, Inc., incorporated on January 18, 2000, is a search provider. The Company offers a Chinese language search platform on its Baidu.com Website that enables users to find information online, including Webpages, news, images, documents and multimedia files, through links provided on its Website. In addition to serving individual Internet search users, the Company provides a platform for businesses to reach customers. Its business consists of three segments: search services, transaction services and an online video platform, iQiyi (Baidu Inc Company Profile, n.d.).

I chose this company because it had a market cap of more than $40B as of May 2019.

Baidu.com was the largest in . Its business model resembled Google in the

United States.

Stock 10: Advanced Micro Devices, Inc. (NASDAQ: AMD)

13 Advanced Micro Devices, Inc., incorporated on May 1, 1969, is a global company. The Company is engaged in offering , as standalone devices or as incorporated into an accelerated processing unit (APU), , discrete graphics processing units (GPUs) and professional graphics, and, server and embedded processors and semi-custom

System-on-Chip (SoC) products and technology for game consoles. The Company's segments include the Computing and Graphics segment, and the Enterprise, Embedded and Semi-Custom segment. The Company sells its products through its direct sales force and through independent distributors and sales representatives in both domestic and international markets. Its microprocessor customers consist primarily of original equipment manufacturers (OEMs), original design manufacturers (ODMs), system builders and independent distributors in both domestic and international markets (Advanced Micro Devices Inc Company Profile, n.d.).

I chose this company because it was included in Nasdaq 100 and S&P 500. AMD, Inc. was considered to be the only competitor to Intel in computer CPU manufacturing and Nvidia in computer GPU manufacturing.

14 Methodology

To analyze the stocks prices, first we needed to find a way to download stock price data.

We chose Yahoo Finance (Yahoo! Finance, n.d.) to download all the historical stock prices, and this site was used every week when new stock prices came out. When downloading the data, we ignored the dividends and focused on the closing price each day. We downloaded the historical prices of the 10 stocks for the past two years as the input for our prediction models.

Autocorrelation Model

Given the historical data for the past two years, we needed to determine for how long the historical data was relevant to future prices. To achieve this, we computed the autocorrelation coefficient of the historical prices of each stock. The autocorrelation function measures the correlation between 푦푡 and 푦푡+푘, where 푘 = 0, … , 푘 and 푦푡 is a stochastic process. The autocorrelation for lag 푘 is

푐푘 푟푘 = 푐푘0 where

푇−푘 1 푐 = ∑(푦 − 푦̅)(푦 − 푦̅) 푘 푇 푡 푡+푘 푡=1 and 푐0 is the sample variance of the time series (autocorr, n.d.). The autocorrelation coefficient measures the similarity between the time series and the delayed copy of the time series itself. We increased the lag by 1 until the autocorrelation coefficient dropped below 0 and this meant that any more lag would lead to data that was irrelevant to current stock prices. We recorded the number of days when the autocorrelation coefficient became zero, and this gave us the relevant

15 period of each stock. The relevant periods were usually several months, as demonstrated by the figure below.

Trend Model

Economic growth usually has a pattern of trends and cycles. The trends determine the long-term movement of the stock and the cycles determine recurring short-term fluctuations. The trend of the data set is given by

푓(푥푖, 훽) = 훽1푥푖 + 훽0

The goal is to find the adjustable parameter 훽, so that the model fits the data set the best. The fit of a model to a data point is measured by its residual, defined as the difference between the actual value of the dependent variable and the value predicted by the model:

푟푖 = 푦푖 − 푓(푥푖, 훽)

The least squares method finds the optimal parameter values by minimizing the sum, 푆, of squared residuals:

푛 2 푆 = ∑ 푟푖 푖=1

16 This is called a linear least squares fit, where 훽1 is the slope and 훽0 is the intercept (Least

Squares, n.d.). An upward-sloping trend predicts that the stock will increase in value, while a downward-sloping trend predicts that the stock will decrease in value. The example below shows that the stock price of DELL will increase in the long run.

Fourier Series Model

If we take the difference between the actual stock prices and the trendline, we will get the short-term fluctuations of the stock. These fluctuations tend to occur in cycles and one way to describe cycles is by Fourier Series. A Fourier Series is a sum of sine and cosine functions, and it can be represented in either the trigonometric form or the exponential form. The trigonometric form is given by

푦 = 푎0 + ∑ 푎푖 cos(푖푤푥) + 푏푖 sin(푖푤푥) 푖=1 where 푎0 models a constant (intercept) term in the data and is associated with the 푖 = 0 cosine term, 푤 is the fundamental frequency of the , 푛 is the number of terms (harmonics) in the series (Fourier Series, n.d.). A Fourier Series repeats itself after its period and hence only reflects

17 the stock’s periodical performance. The degree of the Fourier Series determines the complexity of the Fourier Series Model. While higher-degree Fourier Series often fits the original data better, it may cause overfitting, and the prediction result is not necessarily better than lower- degree Fourier Series. In our examples, a degree of 3 is good enough for the predictions and does not cause overfitting. If we sum the predictions from the trendline and the Fourier Series, we can get predictions for both the trends and the cycles. As shown in the figure below, the actual future prices of DELL generally fell between the error bands of our predictions. This meant that the

Fourier Series Model was fairly meaningful, but it could be improved using the next model.

Fourier Series Correlated with Stock Index Model

Stocks are not only affected by their past prices, but also by other stocks in the market.

One way to describe the overall stock market is using stock indexes. Some of the most well- known stock indexes are NASDAQ Composite Index, NYSE Composite Index, S&P 500 Index, and DOW JONES Industrial Average. Since most stocks we chose were in the NASDAQ

Composite Index, we would examine how it affected the performance of our stocks. We first made predictions for the NASDAQ Composite Index as we did for the stocks. Then we found the

18 correlation coefficients between the index and the stocks. The correlation coefficient of two random variables is a measure of their linear dependence, and it is defined as

푁 1 퐴 − 휇 퐵 − 휇 𝜌(퐴, 퐵) = ∑( 푖 퐴)( 푖 퐵) 푁 − 1 𝜎퐴 𝜎퐵 푖=1 where 휇퐴 and 𝜎퐴 are the mean and standard deviation of A, respectively, and 휇퐵 and 𝜎퐵 are the mean and standard deviation of B (corrcoef, n.d.). The higher the correlation coefficient is, the more closely related the two data sets are. Then we used the autocorrelation coefficient to determine the proportion of the NASDAQ Index prediction to the stock’s own prediction. The final prediction is given by

푃 = (1 − 𝜌)푃푁퐴푆퐷퐴푄 + 𝜌푃푠푡표푐푘

Therefore, the more related the NASDAQ Index and the stock prices are, the more we trust the stock’s prediction. As shown below, the predictions for DELL improved after swapping some of its predictions with the NASDAQ Index predictions.

19 Virtual Portfolio

During the first few weeks of this project, we created a virtual portfolio to evaluate how well our models work and to put into practice our theories. We wanted to demonstrate that we could actually make some earnings by the end of the semester. We invested with an initial capital of $10,000 which was typical for a small investor, but we chose our stocks in percentages, so it could be easily scaled to any amount of investment. We made our investment choices not solely based on our models. We also considered the historical prices of a stock. We first found the historical highs and lows of the stock and determined whether the stock was near its historical high or historical low. If a stock was near its historical low, there was still great room for growth, so we would want to buy more. If a stock was near its historical high, there was a great potential for the price to decrease, so we would want to buy less. Another factor that we took into account was the overall risks of buying the stock. If a stock was a large company and its stock price remained stable, we could consider it to be a low-risk stock. As small investors, we wanted to favor low-risk stocks as we could not afford to lose our initial capital. The final choices were in the following table.

Stocks Percentage MSFT 7.00% AAPL 15.00% FB 10.00% INTC 10.00% ORCL 13.00% QCOM 13.00% NVDA 13.00% DELL 7.00% BIDU 7.00% AMD 5.00% Total 100.00%

20 Results

Autocorrelation Model

MSFT:

Relevant Period: 189 days (8/23/2018 – 5/24/2019)

AAPL:

Relevant Period: 72 days (2/12/2019 – 5/24/2019)

21 FB:

Relevant Period: 61 days (2/28/2019 – 5/24/2019)

INTC:

Relevant Period: 108 days (12/19/2018 – 5/24/2019)

22 ORCL:

Relevant Period: 59 days (3/4/2018 – 5/24/2019)

QCOM:

Relevant Period: 41 days (3/28/2018 – 5/24/2019)

23 NVDA:

Relevant Period: 95 days (1/9/2019 – 5/24/2019)

DELL:

Relevant Period: 212 days (7/23/2018 – 5/24/2019)

24 BIDU:

Relevant Period: 127 days (11/20/2018 – 5/24/2019)

AMD:

Relevant Period: 174 days (9/14/2018 – 5/24/2019)

The average relevant period was 113.8 days, which was about 4 months. This was a sufficiently long period for making future price predictions. The longest period was 212 days from DELL; the shortest period was 41 days from QCOM.

25 Trend Model

MSFT:

AAPL:

26 FB:

INTC:

27 ORCL:

QCOM:

28 NVDA:

DELL:

29 BIDU:

AMD:

Only 1 out of the 10 stocks had a negative slope. This meant that most of the stocks we chose could increase in value. The magnitude of the slope might vary from stock to stock, so it could be used to evaluate the stock’s long-term growth.

30 Fourier Series Model

MSFT:

Valid Period: 13 days Microsoft had a pullback in June due to investor’s confidence in their long-term growth. After all, it was still the largest tech company and acted like a monopoly.

AAPL:

Valid Period: 7 days Our model predicted Apple’s stock prices fairly well, with the exception on June 3. Even on that day, we were only off by a marginal deviation. The valid period would be much longer if we ignored the minor exception.

31 FB:

Valid Period: 0 days Our model did not work well in this case. Facebook’s stock price decreased significantly in early June due to its privacy scandals and mistrust from the public. Its stock price became stable and returned to be within our prediction range in late June.

INTC:

Valid Period: 20 days Our model predicted Intel’s stock price fairly well. Its stock price did not rise as much as predicted in late June probably due to difficulties in manufacturing their new products and increasing competition from AMD.

32 ORCL:

Valid Period: 0 days Our model did not predict Oracle’s stock well. The error was significantly narrower than others, likely due to overfitting. Also, Oracle’s sales grew beyond investor’s expectations in June, which contributed to its price increase.

QCOM:

Valid Period: 5 days Qualcomm’s stock price dropped more than 15% in mid-May due to a fall in demand of their products. Qualcomm’s stock returned to its normal trend of growth in June, but the price drop in May had already influenced our model.

33 NVDA:

Valid Period: 35 days Our model worked extremely well for Nvidia’s stock. The curve fitted perfectly and successfully predicted its trends and cycles.

DELL:

Valid Period: 11 days Dell’s stock price fell in late May due to the lack of innovation in their new products. Being a computer manufacturer, Dell faced intense competition, and the overall market was shrinking.

34 BIDU:

Valid Period: 0 days Baidu’s stock price fell in May because of the trade disputes between the U.S. and China, and the two countries were in high tension. Its stock price stabilized in June as new trade deals were being closed.

AMD:

Valid Period: 11 days AMD’s stock price increased steadily in June as its new CPU products were launched. Thanks to TSMC’s latest 7nm CPU manufacturing technology, AMD was finally able to keep up with the competition from Intel.

35 Stock Valid Period MSFT 13 AAPL 7 FB 0 INTC 20 ORCL 0 QCOM 5 NVDA 35 DELL 11 BIDU 0 AMD 11

The average valid prediction period was 10.2 days, which included 3 stocks that we failed completely. The standard deviation of the valid periods was 10.3 days. If we excluded the anomalies, the average prediction period would be 14.6 days, slightly proud of 2 weeks. The reason why we did not predict some of the stocks accurately was probably because of overfitting.

If we used a model that was more complicated that the actual stock’s performance, we might get very close past approximations but very divergent future predictions. Another reason was because of the nature of the stock market. Sometimes, there were too many factors affecting one stock that our model could not capture. Not all factors affecting the future price were predictable.

For example, Baidu’s stock price was not only determined by the company itself, but also one country’s diplomatic relationship with another country. However, this model might be improved by taking into account other factors, such as the stock market index in the next model.

36 Fourier Series Correlated with Stock Index Model

MSFT:

Valid Period: 13 days There was no significant difference in predictions between this model and the last model.

AAPL:

Valid Period: 7 days There was no significant difference in predictions between this model and the last model.

37 FB:

Valid Period: 0 days There was no significant difference in predictions between this model and the last model.

INTC:

Valid Period: 35 days In the last model, we were very confident that the Intel stock would go up in price in June. By considering the NASDAQ Index, we introduced more fluctuations and hence a more conservative lower bond. Therefore, the accuracy of the predictions was enhanced.

38 ORCL:

Valid Period: 6 days There was no significant difference in predictions between this model and the last model.

QCOM:

Valid Period: 35 days Qualcomm’s price spike around May largely influenced the predictions by the last model. In the meantime, the NASDAQ Index remained relatively stable, so it was more likely to produce the correct outcome. Since Qualcomm’s stock prices did not correlate well with the NASDAQ Index, we weighed NASDAQ predictions more. Therefore, we were able to focus on the real trend and ignore the abnormal prices.

39 NVDA:

Valid Period: 35 days There was no significant difference in predictions between this model and the last model.

DELL:

Valid Period: 32 days The overall demand for personal computers had been falling, so computer manufacturers were all having a hard time maintaining growth. By comparing other stocks in the market, we successfully predicted the very negative trend for Dell. The length of the valid prediction period was improved by 21 days.

40 BIDU:

Valid Period: 35 days Baidu’s stock price had the most tremendous difference in predictions between this model and the last model. Because of the trade wars between the U.S. and China, Baidu’s stock was greatly undervalued. By taking into account the NASDAQ Index, we managed to foresee that Baidu’s stock price would return to normal and hence should have an upward-sloping trend as opposed to the downward-sloping trend in the last model. The flipped trend improved the valid prediction period from 0 days to the maximum 35 days.

AMD:

Valid Period: 12 days There was no significant difference in predictions between this model and the last model.

41 Stock Valid Period MSFT 13 AAPL 7 FB 0 INTC 35 ORCL 6 QCOM 35 NVDA 35 DELL 32 BIDU 35 AMD 12

The average valid period was 21 days, which was 3 weeks out of the total 5 weeks. The standard deviation of the valid periods was 13.8 days. Using this model, we only failed to predict one stock. Most of the stocks we chose correlated well with the NASDAQ Index. In fact, many stocks were part of the NASDAQ Index themselves. High correlation coefficient meant similar prediction results to the last model. However, for stocks that did not correlate well with the

NASDAQ Index, we were able to ignore their anomalous data and find out the real trend. The much longer valid period of 3 weeks showed that the NASDAQ Index helped to improve the accuracy of the Fourier Series Model a lot.

42 Virtual Portfolio

5/24/19 5/31/19 6/7/19 6/14/19 6/21/19 6/28/19 MSFT $126.24 $123.68 $131.40 $132.45 $136.97 $133.96 AAPL $178.97 $175.07 $190.15 $192.74 $198.78 $197.92 FB $181.06 $177.47 $173.35 $181.33 $191.14 $193.00 INTC $44.57 $44.04 $46.03 $46.19 $47.46 $47.87 ORCL $52.77 $50.60 $53.26 $53.28 $56.12 $56.97 QCOM $66.21 $66.82 $68.69 $68.72 $72.72 $76.07 NVDA $145.15 $135.46 $145.50 144.64 $151.76 $164.23 DELL $66.12 $59.55 $54.30 $51.32 $53.99 $50.80 BIDU $114.47 $110.00 $109.81 $113.08 $116.91 $117.36 AMD $26.44 $27.41 $32.41 $30.36 $29.10 $30.37 Total Gain 0.00% -2.85% 4.24% 0.20% 4.01% 1.66%

Except for the first week, we managed to get positive profits every week. The overall gain was 7.25% over a period of 5 weeks which was high enough compared to other forms of investments. With our initial capital of $10,000, we were able to state that we could have made

$725 in 5 weeks. This proved our portfolio selection to be very successful. However, since our models were improved over the semester, and the Fourier Series Correlated with Stock Index

Model achieved an average valid prediction period of 3 weeks, we could have earned more with our latest, most accurate models.

43 Conclusion

In general, our project proved to be a success. We accomplished our goals by providing small investors with simple tools they could use on their personal computers to earn money with little initial capital and little computing resources. The models we designed were very flexible and could be easily tailored to one’s own investment preference. Our most accurate model, the

Fourier Series Correlated with Stock Index Model had an average valid prediction period of 21 days, and it was more than enough for us to use it to make profits. With our virtual portfolio, we demonstrated that our models worked well in the real world and earned 7.25% in total. Both our theoretical models and the real-world applications of those models yielded satisfactory results.

At the end of this project, we were confident to recommend our models to all small investors interested in investing in the U.S. stock market.

44 Bibliography

Advanced Micro Devices Inc Company Profile. (n.d.). Retrieved July 2019, from : https://www.reuters.com/finance/stocks/company-profile/AMD.O Apple Inc Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/AAPL.O autocorr. (n.d.). Retrieved July 2019, from MathWorks: https://www.mathworks.com/help/econ/autocorr.html Baidu Inc Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/BIDU.O corrcoef. (n.d.). Retrieved July 2019, from MathWorks: https://www.mathworks.com/help/matlab/ref/corrcoef.html Dell Technologies Inc Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/DELL.N Facebook Inc Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/FB.O Fourier Series. (n.d.). Retrieved July 2019, from MathWorks: https://www.mathworks.com/help/curvefit/fourier.html Intel Corp Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/INTC.O Least Squares. (n.d.). Retrieved July 2019, from Wikipedia: https://en.wikipedia.org/wiki/Least_squares MATLAB. (n.d.). Retrieved July 2019, from MathWorks: https://www.mathworks.com/products/matlab.html Microsoft Corp Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/MSFT.O Nvidia Corp Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/NVDA.O Oracle Corp Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/ORCL.N Qualcomm Inc Company Profile. (n.d.). Retrieved July 2019, from Reuters: https://www.reuters.com/finance/stocks/company-profile/QCOM.O Yahoo! Finance. (n.d.). Retrieved July 2019, from Yahoo: https://finance.yahoo.com

45