Type: Package
Title: Imports Datasets from BCB (Central Bank of Brazil) using Its Official API
Version: 0.9.0
Maintainer: Marcelo Perlin <marceloperlin@gmail.com>
Description: Downloads and organizes datasets using BCB's API https://www.bcb.gov.br/. Offers options for caching with the 'memoise' package and , multicore/multisession with 'furrr' and format of output data (long/wide).
Depends: R (≥ 3.3.0)
Imports: stringr, utils, curl,dplyr, future, furrr, jsonlite, memoise, purrr, methods, cli
License: GPL-2
BugReports: https://github.com/msperlin/GetBCBData/issues
URL: https://github.com/msperlin/GetBCBData/
RoxygenNote: 7.3.2
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0), ggplot2
VignetteBuilder: knitr
Encoding: UTF-8
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2025-04-29 17:53:20 UTC; msperlin
Author: Marcelo Perlin [aut, cre]
Repository: CRAN
Date/Publication: 2025-04-29 18:10:06 UTC

Imports time series data from BCB-SGS System (Banco Central do Brasil, sistema de series temporais)

Description

Using BCB's oficial API at <https://www.bcb.gov.br/>, this function will download data for a specific set of ids and dates. The main advantage is the use of caching and parallel computing for fast operations. You can search for available series at <https://www.bcb.gov.br/?sgs>

Usage

gbcbd_get_series(
  id,
  first.date = Sys.Date() - 5 * 365,
  last.date = Sys.Date(),
  format.data = "long",
  be.quiet = FALSE,
  use.memoise = TRUE,
  cache.path = gbcbd_get_default_cache_folder(),
  do.parallel = FALSE
)

Arguments

id

Id of time series. The name of the vector sets the name of the series in the output (e.g i.d <- c('SELIC' = 11)). You can search for ids in the official BCB-SGS webpage <https://www.bcb.gov.br/?sgs>

first.date

First date of time series

last.date

Last date of time series

format.data

The format of the datasets - long (default, series incremented by rows) or wide (series incremented by columns)

be.quiet

Logical. Should functions output messages to screen? - FALSE (default) or TRUE

use.memoise

Logical. Sets the use of caching system - TRUE (default) or FALSE

cache.path

Path to save cache files - 'rbcb2_cache' (default)

do.parallel

Logical for parallel data importation - FALSE (default)

Value

A dataframe with requested datasets

Examples


## Not run: 
my.id <- c('Selic Rate' = 11)
df <- gbcbd_get_series(my.id, cache.path = tempdir())

## End(Not run)