Open Data Sources

To increase reproducibility, all data are free and can be loaded from the quantmod R package with the function getSymbols(). It is possible to choose between different data sources like yahoo-finance (default), alpha-vantage and others.

R Functions

The following functions were created to increase the ease of data collection with the quantmod R package, which can be found in the R/ directory in the dedicated GitHub repository [@GitHub].

get_yf()

This function is the main wrapper for collecting data with getSymbols() from yahoo-finance, and converts prices to returns with the pri_to_ret() function explained in section \@ref(pritoret). The output is a list containing prices and returns as xts objects, which is the usual object in R for storing time series. The arguments that can be passed to get_yf() are:

buffer()

To make data reusable and reduce compilation time, the buffer() function stores the data collected with get_yf(). It receives an R expression, evaluates it and stores it in the buffer_data/ directory under the specified name. If this name already exists, it loads the R object from the RData files without evaluating the expression. The evaluation and overwriting of the existing RData file can be forced with force=T.



AxelCode-R/Master-Thesis documentation built on Feb. 25, 2023, 7:57 p.m.