Question 5

In quantmod package, getSymbols() function loads and manages data from multiple sources.

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
getSymbols("AAPL")
## [1] "AAPL"

Question 6

This should return the daily stock prices for Microsoft during 2025-10-01 ~ 2026-01-31

getSymbols("MSFT", src="yahoo",from="2025-10-01",to="2026-01-31")
## [1] "MSFT"

Question 7

How many days of stock prices did you obtain? 84 entries

Question 8

Which time period did open prices reach the highest?

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

#### Oct 27 - Nov 4

Question 10

Extracting data from new API

install.packages(“gtrendsR”)

library(gtrendsR)

Now I will plot the data in a line graph

plot(iphone_data$date, iphone_data$hits,
     type = "l",
     main = "When people are most interested in 'Buy iPhone'",
     xlab = "2025-01-01 2025-12-31",
     ylab = "Amounts of interest" )

The graph shows most people are interested in buying an iPhone after October 2025 into January 2026.

I was able to come to this conclusion by using gtrends, my keyword of “buy iPhone”, time period being 2025, and geo as US so I only got US data. I wanted to see the trend in interest over time of iPhones. For the graph I used the plot function. My two axis were the time and amount of interest. Using type = “l” means it will be a line graph. xlab represented the x-axis and ylab represented the y-axis.