Chapter 1 Things you need to know before the exercise

There is an extensive range of packages in R. For collecting and analyzing financial time series, some of the packages we will use include:

  • Financial data collection from internet (tidyquant)

  • Time series (xts,zoo)

  • Non-linear volatility models (rugarch)

  • Regime modeling (fxregime)

The first package (tidyquant) facilitates collecting financial data from the internet sites:

-   Stocks: GE, AMZN, BAC, etc.

-   Indexes: SP500, VIX

    • Interest rates of US Government Bonds/Bills

    • Interest rates of Foreign governments

    • Foreign exchange rates

    • Commodities: West-Texas-Intermediate Crude Oil

The R script “fm_intro1.r” (.html or .pdf) illustrates the download of a variety of financial time series data from these internet sites. The script is self documenting. In addition to displaying the time series, the script addresses the issue of merging time series data from common sources and accommodating missing data (NAs). The script creates the daily time series objects which include:

  • Closing prices on stocks (COST, GE, AMZN, GE, GOOG,…)

  • Closing values of indexes (SP500, VIX)

  • Yields on constant maturity US rates/bonds (3MO, 1YR, 5YR, 10 YR)

  • Closing price on crude oil spot price (West Texas Intermediate Crude)

The data objects are saved in an R workspace: “casestudy_1_0.Rdata.” Later we use this workspace in the case study on the Capital Asset Pricing Model (CAPM).

This document details how to download/install R and Rstudio and how to replicate the creation of “fm_intro1.html.”