Downloads and Organizes Financial Data for Multiple Tickers

Makes it easy to download financial data from Yahoo Finance <>.

One of the great things of working in finance is that financial datasets from capital markets are freely available from sources such as Yahoo Finance. This is an excelent feature for building up to date content for classes and conducting academic research.

In the past I have used function GetSymbols from the CRAN package quantmod in order to download end of day trade data for several stocks in the financial market. The problem in using GetSymbols is that it does not aggregate or clean the financial data for several tickers. In the usage of GetSymbols, each stock will have its own xts object with different column names and this makes it harder to store data from several tickers in a single dataframe.

Package BatchGetSymbols is my solution to this problem. Based on a list of tickers and a time period, BatchGetSymbols will download price data from yahoo finance and organize it so that you don't need to worry about cleaning it up yourself.

Main features:

  • Organizes data in a tabular/long or wide format, returning prices and returns
  • A cache system was implemented in version 2.0, meaning that the data is saved locally and only missings portions of the data are downloaded, if needed.
  • All dates are compared to a benchmark ticker such as SP500. You can choose to ignore ticker with a high number of missing dates.
  • User can choose a complete/balanced dataset output. The package uses a benchmark ticker for date comparison (e.g. SP500 - ^GSPC). Days with missing prices and traded volume equal to zero are found and prices are either set to NA or replaced by closest available value.
  • Allows the choice for the wide format, with tickers as columns
  • Users can choose the frequency of the resulting dataset (daily, weekly, monthly, yearly)
  • Option for parallel computing, speeding up the data importation process


# CRAN (official release)

# Github (dev version)

A simple example

See vignette.


Version 2.5 (2019-04-13)

  • Implemented option for parallel computations with BatchGetSymbols
  • Added caching system for index grabing functions (SP500 and IBOV)

Version 2.4 (2019-03-23)

  • Fixed bug in function that downloads SP500 data.

Version 2.3 (2018-11-25)

  • User can now choose to return a full balanced price dataset by filling NA values or volume == 0 for their closest prices.
  • Fixed small bug in cache system when an empty dataframe is returned
  • Fixed bug in function that downloads ibovespa's composition

Version 2.2 (2018-10-10)

  • Users can now set frequency of data (daily, weekly, monthly or yearly)

Version 2.1 (2018-05-08)

Small update:

  • added startup message with book link

Version 2.0 (2018-01-22)

Major update:

  • New fct GetIBovStocks for downloading current composition of Ibovespa
  • New fct for changing to wide format
  • Now the output includes returns and not only prices
  • removed annoying startup message
  • implemented clever caching system for financial data
  • simplified input dates (no need for Date class any more)

Version 1.2 (2017-06-26)

  • Fixed issue with GetSP500(). The wikipedia page changed its code..

Version 1.1 (2016-12-05)

  • Fixed CRAN NOTE (stats not used in imports)
  • Fixed typos and improved vignette
  • Couple of fixes in documentation
  • Added citation message on startup

Version 1.0 (2016-11-06)

  • First commit

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.6.1 by Marcelo Perlin, a year ago

Browse source code at

Authors: Marcelo Perlin [aut, cre]

Documentation:   PDF Manual  

GPL-2 license

Imports stringr, curl, quantmod, XML, tidyr, lubridate, scales, furrr, purrr, future, tibble, zoo, crayon

Depends on rvest, dplyr

Suggests knitr, rmarkdown, testthat, ggplot2

See at CRAN