CITE THIS NOTEBOOK: Linking largest changes in stock prices of Dow Jones companies to company events by Wolfram Emerging Leaders Program. Wolfram Community JAN 27 2023.
The Wolfram Emerging Leaders Program is a 4-month long, project-based program designed for gifted high school students to take a deep dive into a topic of their choice. Students work remotely in small groups to take their project from ideation to completion, with the guidance of Wolfram experts. Wolfram Emerging Leaders Program participants are selected from the Wolfram High School Summer Camp, which is open to talented, STEM-oriented students age 17 and under. This essay was written by:
◼
  • Mahira Hafeez
  • ◼
  • Sajal Shukla
  • ◼
  • Gabriel Yang
  • Using FinancialData and externally collected data on company occurrences, our project maps major changes in stock prices over the past decade to significant company changes as a means of discovering the impact of various events, such as CEO changes, wrongdoings, or the development of new services on public opinion of the company.

    Introduction

    The stock market can act a reliable representation of the health of the economy - a stock market doing well means that businesses are doing well. These companies produce the jobs, goods, and services necessary for a successful economy. The Dow Jones Industrial Average is comprised of thirty major companies on the stock market. As one of the oldest indexes, it can be used to measure how well the stock market is doing overall, though it is less trusted than other larger indexes. Stock prices themselves are determined by the principles of supply and demand. If demand for a stock increases, the price will increase. If supply of a stock increases, meaning fewer people are purchasing shares of the stock, the price will decrease. Vice versa is also true. Major company shifts such as CEO changes, new acquisitions, and launching of products can incite both fear and faith in a company’s growth potential and thereby impact investments. Thus, significant company events can cause both peaks and major decreases in stock prices. This project tracks significant changes in stock prices for Dow Jones companies, retrieves historical data on company changes in the past decade, and finds connections between stock price changes and company events. Every example of output throughout this essay prior to the final output will be done for the specific Dow Jones company, Walt Disney, for the sake of better understanding.

    Data Collection

    Using several sources, data was gathered over main changes each of the Dow Jones Companies experienced over the past 10 years.
    Create a dataset including each company:
    data=Dataset
    
    Out[]=
    3M Company
    2017
    A new developed material becomes popular for many athletic wear manufacturers.
    2022
    Announced it would spin off its healthcare assets to form a new, independent firm.
    Merck & Co. Inc.
    2020
    Acquired Themis Bioscience, a company focused on vaccines and immune-modulation therapies for infectious diseases including COVID-19 and cancer.
    2022
    Announced it would acquire Vence, a livestock management company.
    NIKE Inc.
    2020
    John Donahoe succeeds Mark Parker as CEO.
    2022
    Nike launched the Dunk Genesis Cryptokicks collection, which features over 20,000 NFTs.
    Walt Disney Company
    2020
    Chapek became the new CEO on February 25.
    2022
    A California company had filed a lawsuit in Florida against The Walt Disney Company and Walt Disney Parks and Resort alleging patent infringement over Disney's Genie and Genie+ services.
    Coca-Cola Company
    2016
    Acquired 40% stake in Chi Ltd.
    2019
    New Coke was re-introduced to the market to promote the third season of the Netflix original series, Stranger Things.
    Cisco Systems Inc.
    2021
    Employees were given the option to work remotely permanently.
    2022
    Announced a partnership adding the Microsoft Teams app to its meeting devices.
    Walgreens Boots Alliance Inc.
    2013
    Announced it had acquired Kerr Drug.
    2020
    Walgreens agreed to pay $7.5 million to settle a consumer protection lawsuit accusing the company of placing people's health at risk by permitting an unlicensed person to work as a pharmacist without an adequate background check.
    Verizon Communications Inc.
    2016
    Started using the slogan, Better Matters, in reference to its networks.
    2022
    A hacker gained access to some customers’ accounts and processed unauthorized SIM card changes.
    Intel Corporation
    2019
    Released Agilex FPGAs: chips aimed at data centers, 5G applications, and other uses.
    2022
    Stopped supplying the Russian market.
    Goldman Sachs Inc.
    2018
    Malaysia filed criminal charges against subsidiaries of Goldman and their former employees Leissner and Ng, alleging their commission of misleading statements in order to dishonestly misappropriate US$2.7 billion.
    2021
    Announced that it had agreed to acquire NN Investment Partners.
    rows 1–10 of 29

    Order Yearly Changes in Stock Price

    The function FinancialData provides the stock price in a given year. This allows the changes in the stock price between each consecutive year from 2012 to 2022 to be determined. The changes are then ordered from smallest to greatest.

    Extract Stock Price From a Given Year

    Find stock price for Walt Disney is 2022:
    In[]:=
    FinancialData["Walt Disney",{"2022","2022","Year"}]
    Out[]=
    
    Fri 30 Dec 2022 00:00:00GMT-5
    ,
    $
    86.88
    
    The stock price along with the date are expressed but in order to place all stock price changes from multiple years in order, only the stock price must be extracted.
    Extract the stock price from the end of a given year:
    In[]:=
    Last@First@FinancialData["Walt Disney",{"2022","2022","Year"}]
    Out[]=
    $
    86.88

    Find Change in Stock Price Between Consecutive Years

    Using the extracted stock prices from a given year, we can subtract the stock price value from the previous year to find the total stock price change over a given year.
    Subtract stock price value in 2021 from 2022 value:
    In[]:=
    Subtract[Last@First@FinancialData["Walt Disney Company",{"2022","2022","Year"}],Last@First@FinancialData["Walt Disney Company",{"2021","2021","Year"}]]
    Out[]=
    $
    -68.01
    Since the stock prices extracted were from the very end of the given year, the change in stock price is associated with the more recent year as the changes would've occurred in that year.
    Extract 2022 and associate it with the change in stock price from 2021 to 2022:
    In[]:=
    {DateString[DateObject[First@First@FinancialData["Walt Disney Company",{"2022","2022","Year"}]],{"Year"}],Subtract[Last@First@FinancialData["Walt Disney Company",{"2022","2022","Year"}],Last@First@FinancialData["Walt Disney Company",{"2021","2021","Year"}]]}
    Out[]=
    2022,
    $
    -68.01
    

    Sort Stock Price Changes from 2012 to 2022

    In order to rank the stock price changes, the same process of finding the change between two consecutive years and associating it with the more recent year must be applied from the years of 2012 all the way to 2022. Then, they can be ordered from least to greatest by choosing to rank by the last component which is the stock price change and not the year. The function RankStockPrices is created so it can be applied to any of the Dow Jones companies.
    Find all stock price changes from 2012 to 2022 and rank them based on the last component displayed:
    In[]:=
    RankStockPrices[c_String]:=(SortBy[{{DateString[DateObject[First@First@FinancialData[c,{"2012","2012","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2012","2012","Year"}],Last@First@FinancialData[c,{"2011","2011","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2013","2013","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2013","2013","Year"}],Last@First@FinancialData[c,{"2012","2012","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2014","2014","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2014","2014","Year"}],Last@First@FinancialData[c,{"2013","2013","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2015","2015","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2015","2015","Year"}],Last@First@FinancialData[c,{"2014","2014","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2016","2016","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2016","2016","Year"}],Last@First@FinancialData[c,{"2015","2015","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2017","2017","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2017","2017","Year"}],Last@First@FinancialData[c,{"2016","2016","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2018","2018","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2018","2018","Year"}],Last@First@FinancialData[c,{"2017","2017","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2019","2019","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2019","2019","Year"}],Last@First@FinancialData[c,{"2018","2018","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2020","2020","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2020","2020","Year"}],Last@First@FinancialData[c,{"2019","2019","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2021","2021","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2021","2021","Year"}],Last@First@FinancialData[c,{"2020","2020","Year"}]]},{DateString[DateObject[First@First@FinancialData[c,{"2022","2022","Year"}]],{"Year"}],Subtract[Last@First@FinancialData[c,{"2022","2022","Year"}],Last@First@FinancialData[c,{"2021","2021","Year"}]]}},Last])
    Rank stock price changes between 2012 to 2022 for Walt Disney:
    In[]:=
    RankStockPrices["Walt Disney"]
    Out[]=
    2022,
    $
    -68.01
    ,2021,
    $
    -26.29
    ,2016,
    $
    -0.86
    ,2018,
    $
    2.14
    ,2017,
    $
    3.29
    ,2015,
    $
    10.89
    ,2012,
    $
    12.29
    ,2014,
    $
    17.79
    ,2013,
    $
    26.61
    ,2019,
    $
    34.98
    ,2020,
    $
    36.55
    

    Find the Largest Increase and Decrease in Stock Price

    The first item from the list that the function RankStockPrices outputs will be the smallest increase, which would also be the largest decrease in stock price. The last item in the list will be the greatest increase in stock price.
    Extract first item from list:
    In[]:=
    {First@RankStockPrices["Walt Disney"]}
    Out[]=
    2022,
    $
    -68.01
    
    Extract last item from list:
    In[]:=
    {Last@RankStockPrices["Walt Disney"]}
    Out[]=
    2020,
    $
    36.55
    

    Graph the Largest Increase and Decrease in Stock Price

    The function DateListPlot is used to display the trend in stock prices for a given company from 2012 to 2022.
    Display stock price trend by yearly increments for Walt Disney:
    In[]:=
    DateListPlot[​​FinancialData["Walt Disney Company",{"2011","2022","Year"}],PlotLabelHoldForm["Walt Disney Company Stock Prices"],FrameLabel{"Year","Stock Price"},Frame->True]
    The largest increase and decrease should now be shown on the graph. A legend showing the company events at the times of the largest increase and decrease will also be displayed.

    Graph Largest Decrease

    The function DecreaseEvent is created and it refers to the dataset to find the company event during the year of the largest decrease.
    Find the event for Walt Disney during the greatest decrease in stock prices:
    The function GraphLargestDecrease shows the point of the largest decrease on the graph of the company's stock price trend. It also shows the company event that occurred during the largest decrease in stock prices.
    Show the greatest decrease point on stock price graph for Walt Disney and display company event during that year:

    Graph Largest Increase

    The same process is applied here to graph the point of largest increase and display the company event that occurred during the year of the greatest increase.
    Find the event for Walt Disney during the greatest increase in stock prices:
    Show the greatest increase point on stock price graph for Walt Disney and display company event during that year:

    Graph both the Increase and Decrease on the Same Plot

    When the two functions for the largest increase and decrease are combined to create the function GraphIncreaseDecrease, one graph is obtained for a company and shows the largest increase and decrease with the corresponding events. The increase is shown as a blue point while the decrease is shown as a purple point.
    Display stock price graph for Walt Disney showing the largest increase and decrease in stock prices with the company events during those years:

    Final Output

    The final product will be a dropdown menu with each of the Dow Jones Companies, with the exception of one as it was founded during the past decade. Any other company can be selected and the graph showing the greatest increase and decrease in stock price will be displayed with the legend that shows the events that occurred in those years.
    Create a dropdown for the graph of each company (we have run the code for you already, creating the icon "Pre-Computed Graphs"):

    Conclusion

    Our project demonstrates the significant impact small shifts within a company can have on shareholders’ perspective of the company. CEO changes can have a major impact on stock prices. This may be because CEOs tend to be laid off by a board of directors when the company is performing poorly. This will reduce investments being made, and thus, stock price. On the other hand, if the incoming CEO has an already established positive reputation, investments may spike. Other company shifts, such as expansion of a company, collaboration with other businesses, or the development of new products can lead to both increases and decreases in stock price as they signify growth potential of a company. Moving forward, we’d like to analyze the impact of broader historical events (changes in political leadership, natural disasters, economic recession, etc.) on stock price changes to gain insight into how investments are impacted by major events non-specific to companies. We also hope to branch out to other, more expansive stock indexes, such as the S&P 500 to gather more data and make further conclusions on the factors that impact stock price.

    Sources

    Baker, B. (n.d.). Which factors determine stock prices? Bankrate. Retrieved from https://www.bankrate.com/investing/what-makes-a-stock-go-up-in-price/
    ​
    Dow Jones companies. Dow Jones Companies Sorted by Weight. (n.d.). Retrieved from https://www.slickcharts.com/dowjones
    ​
    Find jobs, salaries, companies, resume help, career paths and more. Zippia. (n.d.). Retrieved from https://www.zippia.com/
    ​
    Harper, D. R. (2022, July 28). What drives the stock market? Investopedia. Retrieved from https://www.investopedia.com/articles/basics/04/100804.asp