R Code

I’m the author of many R packages distributed in CRAN (R repository of packages) and Github. Most packages are related to importing and organizing financial and economic datasets from public sources. I fell that unrestricted access to organized datasets is one of the pillars of reproducible research, which is why I’ve taken so much interest in it over the years.

If you used one of the packages in research, please use the proper citation format with citation('pkgname').


Data Packages

yfR ([Github]https://github.com/msperlin/yfR) and CRAN)
Downloads and Organizes Financial Data from Yahoo Finance (daily prices/returns of stocks and market indices).
GetBCBData ( Github and CRAN)
Imports Datasets from BCB (Central Bank of Brazil) using Its Official API. Its a huge database with many interesting tables.
GetDFPData2 ( Github and CRAN)
Reading Annual Financial Reports from Bovespa’s DFP System. Includes financial reports and many more!
GetHFData ( Github and CRAN)
Download and Aggregate High Frequency Trading Data from Bovespa. Includes high frequency trading data from the exchange. ARCHIVED (data is no longer available)
GetLattesData ( Github and CRAN)
Reading Bibliometric Data from Lattes Platform.
GetQuandlData ( Github and CRAN)
Fast and Cached Import of Data from ‘Quandl’ Using the ‘json API’.
GetTDData ( Github and CRAN)
Get Data for Brazilian Bonds (Tesouro Direto)
simfinR ( Github and CRAN)
Import Financial Data from the ‘SimFin’ Project. DEPRECATED – see simfinapi for a replacement.

Econometric Packages

fMarkovSwitching ( R-forge)
Functions for estimating and simulating an univariate markov regime switching model.

Book packages

afedR3 ( Github only)
Book Companion for Analyzing Financial and Economic Data with R, including functions for downloading datasets, exercises and code.
adfeR ( Github only)
Book Companion for Análise de Dados Financeiros e Econômicos com o R, including functions for downloading datasets, exercises and code.