Introduction
- Our firm is now interested in expanding to technology companies.
- Knowing the returns and volatilities of tech stocks close prices and comparing them with the aluminum, lead, and iron ore we currently invest in is essential.
Objectives
- Which of the ten companies has the highest closing price based on the most recent data?
- The closing price at the end of each month for the 10 tech stocks
- Which of the ten companies have experienced the greatest percent increase in closing price over the course of their existence?
Background
The tech industry stands as the vanguard of innovation, driving global progress and economic growth. With breakthroughs in artificial intelligence, cloud computing, and digital transformation, tech companies continue to redefine the boundaries of possibility. My goal is to identify those poised for remarkable growth through the analysis of historical stock price data of ten tech stocks prices. Apple, Amazon, Alibaba, Salesforce,Facebook, Nvidia, Intel, Microsoft, Alphabet and Tesla provided by Yahoo Finance.
library("readr")
library("dplyr")
library("lubridate")
library("ggplot2")
# read in the Apple data
Apple <- read_csv('data/AAPL.csv', show_col_types = FALSE) %>%
mutate(Name = "Apple")
Amazon <- read_csv('data/AMZN.csv', show_col_types = FALSE) %>%
mutate(Name = "Amazon")
Alibaba <- read_csv('data/BABA.csv', show_col_types = FALSE) %>%
mutate(Name = "Alibaba")
FB <- read_csv('data/FB.csv', show_col_types = FALSE) %>%
mutate(Name = "Facebook")
Crm <- read_csv('data/CRM.csv', show_col_types = FALSE) %>%
mutate(Name = "Salesforce")
GOOG <- read_csv('data/GOOG.csv', show_col_types = FALSE) %>%
mutate(Name = "Alphabet")
Intc <- read_csv('data/INTC.csv', show_col_types = FALSE) %>%
mutate(Name = "Intel")
MICRO <- read_csv('data/MSFT.csv', show_col_types = FALSE) %>%
mutate(Name = "Microsoft")
Nvda <- read_csv('data/NVDA.csv', show_col_types = FALSE) %>%
mutate(Name = "Nivdia")
Tesla <- read_csv('data/TSLA.csv', show_col_types = FALSE) %>%
mutate(Name = "Tesla")
Tech_stock <- bind_rows(Apple,Amazon,Alibaba,FB,Crm,GOOG,Intc,MICRO,Nvda,Tesla) %>%
select(Date,Close, Name) %>%
mutate(Name = factor(Name)) %>%
# Extract Year, month and day from Date
mutate(Year = year(Date), Day = day(Date), Month = month(Date, label = TRUE)) %>%
# create month end column
mutate(Endofmonth = ceiling_date(Date, "month") - days(1))
head(Tech_stock)
Which of the ten companies has the highest closing price based on the most recent data?
After analyzing the data, I discover the company that reigns supreme with the highest close price of recent is Amazon. Amidst the sea of competitors, the company's achievement reflects investor confidence, market dominance and relentless innovation.
# Recent close price
Recent_close <- Tech_stock %>%
select(Close, Name, Year) %>%
filter(Year == 2021)
ggplot(Recent_close, aes(x = Close)) +
geom_density() +
theme(plot.title = element_text(size = 16, face = "italic"), axis.text = element_text ( size = 10)) +
labs(title = "Distribution of Close Price of Ten Tech stock in 2021", caption = "Source: YahooFinance")
Top_close <- Recent_close %>%
group_by(Name) %>%
summarize(Median_close = median(Close), Iqr_Close = IQR(Close)) %>%
arrange(desc(Median_close),desc(Iqr_Close ))
Top_close
ggplot(Recent_close, aes(x = Name, y = Close, fill = Name)) +
geom_col() +
coord_flip()+
labs(title = "Close Price Of The Ten Tech stock in 2021", caption = "Source: YahooFinance")
scale_y_log10()
Closing price at the end of each month for the 10 tech stock.
This line plot paints a vivid picture of the journey traveled by the 10 tech stocks at the end of each month, revealing the ebbs and flows. Each curve tells a story of resilience, adaptation, and opportunity.
Each_end_of_month <- Tech_stock %>%
select(Close, Name, Endofmonth, Year) %>%
group_by(Endofmonth)
ggplot(Each_end_of_month, aes(x = Endofmonth, y = Close, color = Name)) +
theme(plot.title = element_text(size = 16, face = "italic")) +
geom_line(position = "jitter") +
facet_wrap(~ Name) +
scale_y_log10() +
labs(title = "Close Price Of The Ten Tech Stock At The End Of Each Month", caption = "Source: YahooFinance")
Which of the ten companies have experienced the greatest percent increase in closing price over the course of their existence?
Companies like Tesla Technologies showcased exponential growth, with a staggering of more than 25% increase over course of its existence, driven by groundbreaking innovations and strategic market positioning.
# calculate the increasing percentage of the close price
pct_change_of_all <- Tech_stock %>%
select(Year, Close, Name) %>%
group_by(Year, Name) %>%
mutate(pct_change = (lag(Close) - Close)/Close * 100) %>%
ungroup() %>%
arrange(desc(pct_change)) %>%
# remove NA
filter(!is.na(pct_change))
pct_change_of_all
# create a line plot of increasing percentage of close price against Year
ggplot(pct_change_of_all, aes(x = Year, y = pct_change, color = Name)) +
theme(plot.title = element_text(size = 16, face = "italic")) +
geom_line()+
facet_wrap(~ Name) +
labs(title = "Percent Increase Of Closing Price Of Ten Tech Stock, 2010-2019", caption = "Source: YahooFinance",
y = "Percent Increase")
Case study
Companies like Amazon. have navigated turbulent waters to emerge as market leaders, epitomizing the potential for exponential growth within the tech sector.