Install the Packages:
# install.packages("wbstats")
library(wbstats)
# install.packages("quantmod")
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
Question 6: Which of the following exactly return(s) the daily stock
prices for Microsoft during 2025-10-01 ~ 2026-01-31
getSymbols("MSFT", src="yahoo", from = "2025-10-01", to = "2026-02-01")
## [1] "MSFT"
Question 7: How many days of stock prices did you obtain?
number_of_days <- nrow(MSFT)
print(number_of_days)
## [1] 84
Question 8: Could you find out in which time period did Microsoft’s
Open prices reach the highest?
plot(MSFT$MSFT.Open,
main = "Microsoft Open Prices (Oct 2025 - Jan 2026)",
col = "blue",
lwd = 2)

MSFT[which.max(MSFT$MSFT.Open), ]
## MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
## 2025-10-28 550 553.72 540.77 542.07 29986700 541.0574