VPSPulse Mirrors

High-Performance Open-Source Archive

Getting Started

Getting Started

Marcelo Perlin

2026-02-02

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:

A simple example

Let’s have a look at the interest rate in Brazil. After searching for the ids in the SGS system, we find that the daily SELIC rate is 432.

Now, lets download the data with GetBCBData:

library(GetBCBData)
library(dplyr)
library(ggplot2)

my.id <- c(selic = 432)

df.bcb <- gbcbd_get_series(id = my.id ,
                       first.date = '2000-01-01',
                       last.date = Sys.Date(),
                       format.data = 'long',
                       use.memoise = TRUE, 
                       cache.path = tempdir(), # use tempdir for cache folder
                       do.parallel = FALSE)

glimpse(df.bcb)
## Rows: 9,530
## Columns: 4
## $ ref.date    <date> 2000-01-01, 2000-01-02, 2000-01-03, 2000-01-04, 2000-01-0…
## $ value       <dbl> 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19…
## $ id.num      <dbl> 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, 432…
## $ series.name <chr> "selic", "selic", "selic", "selic", "selic", "selic", "sel…
p <- ggplot(df.bcb, aes(x = ref.date, y = value/100) ) +
  geom_line() + 
  labs(title = 'Selic Rate', 
       subtitle = paste0(min(df.bcb$ref.date), ' to ', max(df.bcb$ref.date)),
       x = '', y = 'Interest Rate') + 
  theme_light()
  
print(p)

Need mirroring services?
Contact our team at info@vpspulse.com.

Mirror powered by VPSpulse

Infrastructure sponsored by VPSPulse & Secure Payments by ArionPay.