knitr::opts_chunk$set(
  collapse = TRUE, 
  results = 'hold',
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

R-CMD-check

Motivation

The Central Bank of Brazil (BCB) offers access to its SGS system (sistema gerenciador de series temporais) with a official API available here.

Package GetBCBData offers a R interface to the API and many other advantages:

Installation

# CRAN (official release)  
install.packages('GetBCBData')

# Github (dev version)
devtools::install_github('msperlin/GetBCBData')

A simple example

library(GetBCBData)
library(ggplot2)

my.id <- c('Selic' = 432)
df.bcb <- gbcbd_get_series(my.id, cache.path = tempdir())

head(df.bcb)

p <- ggplot(df.bcb, aes(x = ref.date, y = value) ) +
  geom_line() + 
  labs(title = 'SELIC', 
       subtitle = paste0(min(df.bcb$ref.date), ' to ', max(df.bcb$ref.date)),
       x = 'Time', y = 'Percentage*100') + 
  theme_light()


print(p)


msperlin/GetBCBData documentation built on June 12, 2025, 9:33 p.m.