Multiple Choices: xts and quantmod packages
- Which function from the
xts
package is used to create anxts
object from a data frame with a date column? ::: {.cell}
- To retrieve historical stock data for Apple (AAPL) from Yahoo Finance, which function from the
quantmod
package should you use? ::: {.cell}
:::
- Which argument in
getSymbols()
specifies the source of financial data, such as Yahoo Finance or Alpha Vantage? ::: {.cell}
:::
- Which function from the
xts
package is used to select data within a specific date range? ::: {.cell}
:::
- To add a moving average to a time series plot of stock prices, which
quantmod
function should you use? ::: {.cell}
:::
- If you want to convert an
xts
object to a data frame, which function would you use? ::: {.cell}
:::
- Which function from
quantmod
would you use to retrieve the open, high, low, and close prices for a given stock in a candle chart format? ::: {.cell}
:::
- To calculate a 20-day exponential moving average (EMA) on a stock price series, which function and code would you use? ::: {.cell}
:::
- Which function in the
xts
package would you use to merge twoxts
time series objects by aligning them based on their timestamps? ::: {.cell}
:::
- To add Bollinger Bands to a time series chart in
quantmod
, which function should be used? ::: {.cell}
:::
- Which function from the
xts
package allows you to calculate daily, weekly, or monthly returns for a time series? ::: {.cell}
:::
- To obtain only the closing prices from an
xts
object containing OHLC data, which function or syntax should you use? ::: {.cell}
:::
- Which function in
quantmod
would you use to create a technical chart with volume bars below the price chart? ::: {.cell}
:::
- If you want to view quarterly aggregated values of an
xts
object, which function would allow you to achieve this? ::: {.cell}
:::
- Which code would correctly download and store data for multiple tickers (“AAPL” and “MSFT”) in a single
xts
object? ::: {.cell}
:::
16.To lag an xts
time series by one period, which function should you use? ::: {.cell}
:::
- Which
quantmod
function would you use to add Relative Strength Index (RSI) to a stock price chart? ::: {.cell}
:::
- What argument would you set in
getSymbols()
to specify a date range for the data, e.g., starting from January 1, 2020? ::: {.cell}
:::
- To merge two
xts
time series objects but fill any missing values with zeros, which argument inmerge()
should be used? ::: {.cell}
:::
- Which function allows you to plot an
xts
object directly with a customized date axis? ::: {.cell}
:::
- To convert daily stock data in an
xts
object to monthly data, using the last observation of each month, which function should you use? ::: {.cell}
:::
- If you want to check the periodicity (e.g., daily, monthly) of an
xts
object, which function should you use? ::: {.cell}
:::
- In the
quantmod
package, which function would you use to add a Moving Average Convergence Divergence (MACD) indicator to a stock chart? ::: {.cell}
:::
- To remove weekends and holidays from an
xts
time series, which function can you use? ::: {.cell}
:::
- To subset an
xts
object for a specific year, such as 2022, what syntax should you use? ::: {.cell}
:::
- Which function from the
xts
package allows you to apply a function to each day, week, month, or quarter in anxts
time series? ::: {.cell}
:::
- To handle missing data in an
xts
object by carrying forward the last available value, which function should you use? ::: {.cell}
:::
- To calculate daily returns using closing prices in an
xts
object, which function should you use? ::: {.cell}
:::
- To visualize a technical indicator like RSI with a different panel below the main price chart in
quantmod
, which argument should you set when usingchartSeries()
? ::: {.cell}
:::
- Which
quantmod
function allows you to set the color scheme of a chart to a custom color palette? ::: {.cell}
:::
:::