myGetSymbols: An improved version of function 'getSymbols' from quantmod

Description Usage Arguments Value See Also Examples

View source: R/myGetSymbols.R

Description

This is a helper function to BatchGetSymbols and it should normaly not be called directly. The purpose of this function is to download financial data based on a ticker and a time period. The main difference from getSymbols is that it imports the data as a dataframe with proper named columns and saves data locally with the caching system.

Usage

1
2
myGetSymbols(ticker, src = "yahoo", first.date, last.date,
  do.cache = TRUE, cache.folder = file.path(tempdir(), "BGS_Cache"))

Arguments

ticker

A single ticker to download data

src

The source of the data ('google' or'yahoo')

first.date

The first date to download data (date or char as YYYY-MM-DD)

last.date

The last date to download data (date or char as YYYY-MM-DD)

do.cache

Use caching system? (default = TRUE)

cache.folder

Where to save cache files? (default = 'BGS_Cache')

Value

A dataframe with the financial data

See Also

getSymbols for the base function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
ticker <- 'FB'

first.date <- Sys.Date()-30
last.date <- Sys.Date()

## Not run: 
df.ticker <- myGetSymbols(ticker,
                          first.date = first.date,
                          last.date = last.date)

## End(Not run)

Example output

Loading required package: rvest
Loading required package: xml2

Thank you for using BatchGetSymbols! If applicable, please use the following citation in your research report. Thanks! 

APA:
 Perlin, M. (2016) BatchGetSymbols: Downloads and Organizes Financial Data for Multiple Tickers. CRAN Package, Available in https://CRAN.R-project.org/package=BatchGetSymbols. 

BIBTEX:
 @misc{perlin2016batchgetsymbols,
  title = {BatchGetSymbols: Downloads and Organizes Financial Data for Multiple Tickers},
  author = {Marcelo Perlin},
  year = {2016},
  journal = {CRAN Package},
  url = {https://CRAN.R-project.org/package=BatchGetSymbols}
}

BatchGetSymbols documentation built on Nov. 25, 2018, 5:04 p.m.