library(wbstats)
library(quantmod)

Question 6

The goal is to retrieve daily stock prices for Microsoft (MSFT) for the period: 2025-10-01 to 2026-01-31 (inclusive).

getSymbols("MSFT", src="yahoo",from = "2025-10-01", to = "2026-01-31")
## [1] "MSFT"
head(MSFT)
##            MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
## 2025-10-01    514.80    520.51   511.69     519.71    22632300      518.7391
## 2025-10-02    517.64    521.60   510.68     515.74    21222900      514.7766
## 2025-10-03    517.10    520.49   515.00     517.35    15112300      516.3835
## 2025-10-06    518.61    531.03   518.20     528.57    21388600      527.5826
## 2025-10-07    528.29    529.80   521.44     523.98    14615200      523.0011
## 2025-10-08    523.28    526.95   523.09     524.85    13363400      523.8695

Question 7

Calculate the total number of trading days returned in the Microsoft (MSFT) dataset.

nrow(MSFT)
## [1] 84

Question 8

Identify the time period during which Microsoft’s Open stock price reached its highest value.

plot(MSFT$MSFT.Open,
     main = "MSFT Open Prices",
     ylab = "Open Price",
     xlab = "Date")