Case Studies

Factors That Helped Increase Prices Of S&P 500 Stocks

Mrinalini Sundar July 29, 2021

Stocks can show different price changes during the day. Their prices rise or fall depending on supply and demand. It is necessary to know the factors that cause the stock prices to decrease or increase. In general, changes in the supply and demand balance play a role in determining stock prices, but there are other factors as well. 

We examine the factors affecting the stocks traded in the stock market in two groups. The first group is micro factors and covers the performance of companies and sectors in general. The second group is macro factors and refers to events that occur around the world. We will consider micro factors in general, namely company related factors. Factors such as the growth of companies, profitability and indebtedness, market cap size are the factors affecting the stocks. In addition, sectoral developments may also affect prices.

Each investor can find stocks in accordance with his/her own budget and investment purpose and create a portfolio for himself/herself. But in order to create this portfolio, you must have detailed information about the stock market and stocks. For successful buying and selling transactions, you should know which factors affect the stocks, be able to interpret them and read the price charts.

Table of Contents

  • Data Sources
  • Data Analysis
  • Analysis Results
  • Summary
  • How Can You Benefit from These Factors?

Data Sources

We will use beautiful soup in order to get the tickers from Wikipedia. In addition, we will use web. DataReader method in order to get the data from Yahoo Finance from 2010 to 2019. Then, we will check if there are missing values in our data. After cleaning and processing the data we will use matplotlib for visualization. 

List of S&P 500 Companies:

Data Analysis

The data used in this article was gathered from Yahoo Finance using web. DataReader method. Amazon, Google, AMD, Microsoft and S&P 500 stocks are used as examples in this article. The dataset used in the article includes data between 2010 and 2019. After scraping the data we will use to_csv method and save the data as sp500_df.csv. Using the sp500_df.head() method, we will see the first five rows in our data. It is easy to see there are multiple variables in the dataset such as data, open, close, high, low, volume and adj close.







Adj. Close




































The Open and Close columns are representing the the starting price and closing price of a particular date. 

The High and Low columns are representing the maximum and minimum price of the day. 

The Adj Close is the closing price after adjustments for all applicable splits and dividend distributions.

The Volume column represents the number of shares traded in a stock or contracts traded in futures or options.

To indicate which factors affect the increase in stock prices, key factors were saved into separate csv file named as company-financials.csv.

  1. Index listing extracted from Wikipedia’s list of S&P 500 companies
  2. Historical data extracted from Yahoo Finance – see sp500_df.csv
  3. Key factors – company-financials.csv (via Yahoo finance)

To more easily understand which factors drive stock prices, we will use the correlation method. Thus, it is possible to mention that the effect on stock prices is greater in cases where the correlation is high. On the contrary, a low correlation can be interpreted as the effect on the price will be lower. 

In order to strengthen the working logic of the program, we will first examine the performance of stock prices over the years. While doing this analysis we will consider the Moving Average and Daily Return.

Analysis Results

Moving Average

Hundreds of indicators are used while using technical analysis method to have foresight in financial markets. Some of these have become more popular due to their usefulness and widespread use. The most widely used indicator among these indicators is the moving average (MA).

Even though moving averages come in many formats, their commonality is in determining and following the trend. The Simple Moving Average (SMA) is the simplest of the moving averages and it is obtained by dividing the total of data by the number of data.


The plot below is representing Adj Close, 200-day Exponential Moving Average 200-day Simple Moving Average and 50-day Simple Moving Average. A death cross appears on a chart when a stock's 50-day simple moving average falls below its 200-day simple moving average. Death cross is considered as a bearish signal that the stock may continue to decrease. Conversely, there is a golden intersection.  The golden cross is when the 50-day moving average breaks the 200-day moving average to the upside. When the plot above is examined, the increase and decrease in stock prices in the gold intersection and death intersection periods are seen. 

Daily Return

The daily return is the dollar change in stock prices as a percentage of the previous day's closing. The plot below shows the daily returns of selected companies and S&P 500. The green line represents the daily return of Amazon. AMZN performed better over the last years than other companies. Which means AMZN has more daily return when compared to other stocks.


The Simple Return of S&P 500 

The simple rate of return is the ratio of the amount of return that is obtained or expected to be obtained from an investment at the end of a certain period to the initial investment amount. 


The plot shows the daily return percentage. Most of the day it is between -4 and 4. But the graph also show that some days the daily return percentages are high.

What About the Factors That Affect the Increase in Stock Prices

We’ve saved the key factors into a csv file named as campany-financials.csv. Before beginning the analysis, it would be beneficial to define what the factors mean:

  • Price: Price per share of the company
  • Price to Earnings (PE): The ratio of a company’s share price to its earnings per share
  • Dividend Yield: The ratio of the annual dividends per share divided by the price per share
  • Earnings Per Share (EPS): A company’s profit divided by the number of shares of its stock
  • 52 week high and low: The annual high and low of a company’s share price
  • Market Cap: The market value of a company’s shares (calculated as share price x number of shares)
  • EBITDA: A company’s earnings before interest, taxes, depreciation, and amortization; often used as a proxy for its profitability
  • Price to Sales (PS): A company’s market cap divided by its total sales or revenue over the past year
  • Price to Book (PB): A company’s price per share divided by its book value

The factors included here will help us to understand the increases in stock prices. The correlation value range between -1 to 1. Keep in mind that the sign of the correlation indicates the direction of the relationship. The correlation of -1 shows a strong negative correlation while the correlation of 1 shows a strong positive correlation. Correlation values ​​above 0.4 are defined as relatively strong. If the correlation values is between 0.4 and 0.2, it is considered as moderate. If the correlation value is above 0.2, it is considered as weak.


From the heatmap above, it can be interpreted that 52 Week Low is the most correlated factor with price with the correlation value of 1. 52 Week High is the second most correlated factor with correlation value of 0.98 and Earnings/Share (EPS) is the third most correlated factor with the correlation value of 0.59. 

52 Week Low and 52 Week High helps the traders to determine an entry or exit point of a stock. Basically, when the price excides it 52 week high it can be considered as entry point, or when the price falls below its 52 week low it can be considered as exit point. 

Earnings per share is the ratio of a company's net income to its outstanding shares.  When comparing companies, the company with higher earnings per share is considered stronger. When the company's current performance is compared to its past performance, the increase in earnings per share indicates increased profitability.

In addition to these factors, it can be said that market cap affects the stock prices. When looking for stocks market cap is one of the factors that is considered. Large cap stocks (more than $10 billion) are considered as mature campanies and they do not pose much risk. On the other hands, small cap stocks ($250 million to $1 billion) may have a growth potential but they pose greater risk than large cap and mid cap stocks. Mid cap stocks can be safe as large cap stock and they can have good growth potential as mid cap stocks.


In this article, we examined how stocks performed between 2010 and 2019 and what factors affected the stock price increase. It is obvious to see that Amazon has performed better growth than other companies. In addition, we have seen that factors such as earnings per share, market cap, 52 week low and 52 week high are effective in increasing stock prices. After analyzing the visuals, we can say that these factors have strong potential to drive increase in stock prices.

How Can You Benefit from These Factors?

If you are trading, you may need to do some research on stocks before you start trading. By examining these factors, for example by looking at the market cap size, you can decide whether the stock has growth potential. 

You can examine the buy and sell signals. In this way, you will learn at which points you can buy or sell. Using these factors, you can determine which stocks may increase in the future. Thus, you can make your investments on these stocks.

Share On Social Media: