get_normative_data: Download normative acts from the Brazilian Central Bank...

View source: R/get_normative_data.R

get_normative_dataR Documentation

Download normative acts from the Brazilian Central Bank (Bacen) by terms and date range

Description

[Stable]

Queries the Bacen normative search API, collects all results within the provided date range and returns a data.frame with the records. Data are downloaded from https://www.bcb.gov.br/estabilidadefinanceira/buscanormas.

Usage

get_normative_data(terms, ini_date, end_date)

Arguments

terms

Character vector. Search terms; they will be concatenated with " OR " and URL-encoded.

ini_date

Character. Start date in "YYYY-MM-DD" format.

end_date

Character. End date in "YYYY-MM-DD" format.

Details

  1. Builds the query URL using the terms and the date range.

  2. Retrieves the total number of results to determine the page size.

  3. Iterates over result pages (incrementing by 500) until a page returns fewer than 13 rows (stop condition).

  4. Performs simple cleaning on returned fields:

    • removes "string;#" prefixes,

    • removes HTML tags in summaries and subjects,

    • removes the decimal part of normative numbers.

Value

data.frame containing the records returned by the API and the post-processed columns. Returns an empty data.frame if the server is unavailable or no internet connection.

Examples

## Not run: 
ini_date <- "2025-01-01"
end_date <- "2025-01-05"
terms <- c("Cooperativas", "Cooperativa")
normas <- get_normative_data(terms, ini_date, end_date)

## End(Not run)

bacenR documentation built on Oct. 24, 2026, 1:07 a.m.