Title: Simplified Access to Brazilian Financial and Macroeconomic Data
Version: 0.2.1
Description: It offers simplified access to Brazilian macroeconomic and financial indicators selected from official sources, such as the 'IBGE' (Brazilian Institute of Geography and Statistics) via the 'SIDRA' API and the 'Central Bank of Brazil' via the 'SGS' API. It allows users to quickly retrieve and visualize data series such as the unemployment rate and the Selic interest rate. This package was developed for data access and visualization purposes, without generating forecasts or statistical results. For more information, see the official APIs: https://sidra.ibge.gov.br/ and https://dadosabertos.bcb.gov.br/dataset/.
License: MIT + file LICENSE
URL: https://github.com/efram2/brfinance
BugReports: https://github.com/efram2/brfinance/issues
Encoding: UTF-8
RoxygenNote: 7.3.2
Depends: R (≥ 4.1.0)
Imports: dplyr, ggplot2, scales, httr2, lubridate, sidrar, stringr, janitor
Suggests: testthat (≥ 3.0.0), rmarkdown
NeedsCompilation: no
Packaged: 2025-10-17 02:36:47 UTC; user
Author: João Paulo dos Santos Pereira Barbosa [aut, cre]
Maintainer: João Paulo dos Santos Pereira Barbosa <joao.31582129@gmail.com>
Repository: CRAN
Date/Publication: 2025-10-17 16:30:02 UTC

Get daily Brazilian SELIC rate data (annualized, base 252)

Description

Downloads the daily SELIC rate series (ID 1178) from the Central Bank of Brazil’s SGS (Time Series Management System) API. Returns a tidy data frame.

Usage

get_selic_rate(start_year, end_year, language = "eng")

Arguments

start_year

Starting year (e.g., 2020)

end_year

Ending year (e.g., 2024)

language

Language for column names: "pt" for Portuguese or "eng" (default) for English

Value

A tibble with SELIC rate data between the selected years.

Examples

## Not run: 
selic_data <- get_selic_rate(2020, 2024)

## End(Not run)

Retrieve Brazil's quarterly unemployment rate

Description

Downloads and cleans data from IBGE's Continuous PNAD via SIDRA API.

Usage

get_unemployment(start_year, end_year, language = "eng")

Arguments

start_year

Starting year (e.g., 2015)

end_year

Ending year (e.g., 2024)

language

Language of labels: "eng" (default) or "pt"

Value

A tibble with columns: date and rate

Examples

## Not run: 
data <- get_unemployment(2018, 2024, language = "pt")

## End(Not run)

Plot Brazilian SELIC rate (annualized, base 252)

Description

Generates a time series plot of the SELIC interest rate using data from get_selic(). The SELIC rate ("Sistema Especial de Liquidação e de Custódia") represents the effective annualized rate (252-business-day basis) for overnight interbank loans and is the main instrument of Brazil’s monetary policy.

Usage

plot_selic_rate(data, language = "eng")

Arguments

data

Tibble returned by get_selic_rate()

language

Language for titles and labels: "pt" (Portuguese) or "eng" (English).

Value

A ggplot2 object showing the SELIC rate over time.

Examples

## Not run: 
# Example 1: English version
selic_data <- get_selic_rate(2020, 2024)
selic_plot <- plot_selic_rate(selic_data)
print(selic_plot)

# Example 2: Portuguese version
dados_selic <- get_selic_rate(2020, 2024, language = "pt")
grafico_selic <- plot_selic_rate(dados_selic, language = "pt")
print(grafico_selic)

## End(Not run)

Plot Brazil's quarterly unemployment rate

Description

Generates a ggplot2 line chart of unemployment rate in Brazil.

Usage

plot_unemployment(data, language = "eng")

Arguments

data

Tibble returned by get_unemployment()

language

Language for column names: "pt" for Portuguese or "eng" (default) for English

Value

A ggplot2 object

Examples

## Not run: 
# Example 1: English version
unemployment_data <- get_unemployment(2020, 2024)
unemployment_plot <- plot_unemployment(unemployment_data)
print(unemployment_plot)

# Example 2: Portuguese version
dados_desemprego <- get_unemployment(2020, 2024, language = "pt")
grafico_desemprego <- plot_unemployment(dados_desemprego, language = "pt")
print(grafico_desemprego)

## End(Not run)