output: html_document: toc: true —

Retrieve the following data by revising the given code below.

Q1. Netflix for the period of 2014-01-01 - 2017-12-31 from Google

# Load packages
library(quantmod)

data <- getSymbols("NFLX", from = "2014-01-01", to = "2017-12-31" , src = "yahoo", auto.assign = FALSE)
plot(data)

Q2. US unemployment rate (monthly seasonally adjusted) from FRED

data <- getSymbols("UNRATE", from = "2005-12-31", to = "2016-08-31" , src = "FRED", auto.assign = FALSE)
plot(data)

Q3. Foreign exchange rate, Korean won per US dollar from Oanda.com (Hint: Oanda.com only reports data for the past 180 days)

data <- getSymbols("USD/KRW", src = "oanda", auto.assign = FALSE)
plot(data)

Q4. You are interested in studying stock price changes (without dividend payments) of three tech giants - Microsoft, Apple, and Amazon. Load three stocks; extract the Close column from each of the three stocks; and merge them into one object.

# Create a new environment
data_env <- new.env()
getSymbols(c("MSFT", "AMZN" , "AAPL"), env = data_env, auto.assign = TRUE)
## [1] "MSFT" "AMZN" "AAPL"
adjusted_list <- lapply(data_env, Vo)
adjusted <- do.call(merge, adjusted_list)
head(adjusted)
##            AAPL.Volume AMZN.Volume MSFT.Volume
## 2007-01-03   309579900    12405100    76935100
## 2007-01-04   211815100     6318400    45774500
## 2007-01-05   208685400     6619700    44607200
## 2007-01-08   199276700     6783000    50220200
## 2007-01-09   837324600     5703000    44636600
## 2007-01-10   738220000     6527500    55017400