MyNixOS website logo
Description

Access to Brazilian Macroeconomic and Financial Time Series.

Provides simplified access to selected Brazilian macroeconomic and financial time series from official sources, primarily the Central Bank of Brazil through the SGS (Sistema Gerenciador de SΓ©ries Temporais) API. The package enables users to quickly retrieve and visualize indicators such as the unemployment rate and the Selic interest rate using a standardized data structure. It is designed for data access and visualization purposes, without performing forecasts or statistical modeling. For more information, see the official API: <https://dadosabertos.bcb.gov.br/dataset/>.

brfinance πŸ“ŠπŸ‡§πŸ‡·

CRANStatus License:MIT R-CMD-check Downloads Downloads GitHubstars GitHubforks

brfinance is an R package that provides simplified access to Brazilian macroeconomic time series from the Central Bank of Brazil, along with practical financial calculators.

If you work with Brazilian data, interest rates, inflation, or financial math, this package is for you.


Why brfinance?

With brfinance, you can:

  • Access official Brazilian macroeconomic time series from the Central Bank of Brazil (SGS)
  • Retrieve clean and standardized time series (date + value)
  • Plot key indicators with one line of code
  • Run financial calculations (NPV, IRR, PV, FV, PMT, rates)

No manual API handling. No data wrangling required.


Installation

install.packages("brfinance")

# Or development version from GitHub
install.packages("devtools")
devtools::install_github("efram2/brfinance")

library(brfinance)

πŸš€ Quick Start

Inflation (IPCA)

plot_inflation_rate(
  get_inflation_rate("2020", "2024")
)

SELIC interest rate

plot_selic_rate(
  get_selic_rate(2020, 2024)
)

Unemployment rate

plot_unemployment(
  get_unemployment("2019", "2024")
)

Compare multiple indicators in one chart

You can compare different economic indicators using: 1. raw values 2. indexed series (base = first observation) 3. percentage change from the first observation

  • Want to analyze how different economic indicators evolve together?
  • Use plot_series_comparison() to compare multiple time series in a single, clean visualization.
plot_series_comparison(
  data_list = list(
    "SELIC" = get_selic_rate(2020, 2024),
    "IPCA"  = get_inflation_rate("2020", "2024"),
    "Unemployment" = get_unemployment("2020", "2024")
  ),
  y_vars = rep("value", 3),
  date_vars = rep("date", 3),
  scale_type = "index",
  title = "Brazilian Economic Indicators",
  subtitle = "Indexed comparison (base = first observation)"
)

Financial Calculators (minimalista)

# Net Present Value
calc_npv(0.1, c(-1000, 300, 400, 500))

# Internal Rate of Return
calc_irr(c(-1000, 300, 400, 500))

# Loan payment
calc_pmt(rate = 0.02, n = 24, pv = 10000)

Function Reference

Data retrieval functions (get_*)

  • get_inflation_rate() β†’ Retrieves Brazil’s official inflation rate (IPCA)
  • get_selic_rate() β†’ Retrieves the SELIC interest rate
  • get_cdi_rate() β†’ Retrieves the CDI interest rate
  • get_exchange_rate() β†’ Retrieves official exchange rates
  • get_gdp_growth() β†’ Retrieves GDP growth rates
  • get_unemployment() β†’ Retrieves unemployment rate from PNAD ContΓ­nua

All get_* functions support flexible date inputs: "YYYY", "YYYY-MM", or "YYYY-MM-DD".


Plotting functions (plot_*)

  • plot_inflation_rate() β†’ Plots IPCA inflation over time
  • plot_selic_rate() β†’ Plots the SELIC interest rate
  • plot_cdi_rate() β†’ Plots the CDI interest rate
  • plot_exchange_rate() β†’ Plots exchange rate time series
  • plot_gdp_growth() β†’ Plots GDP growth over time
  • plot_unemployment() β†’ Plots unemployment rate time series
  • plot_series_comparison() β†’ Compares multiple economic indicators in one chart

Financial calculators (calc_*)

  • calc_pv() β†’ Present Value
  • calc_fv() β†’ Future Value
  • calc_npv() β†’ Net Present Value
  • calc_irr() β†’ Internal Rate of Return
  • calc_pmt() β†’ Loan payment calculation
  • calc_rate() β†’ Interest rate calculation
  • calc_nper() β†’ Number of periods
  • calc_compound_interest() β†’ Compound interest calculation
  • calc_continuous_interest() β†’ Continuous compounding
  • calc_rule72() β†’ Rule of 72 approximation
  • calc_rule114() β†’ Rule of 114 approximation

Language Support

All main functions support bilingual output:

  • language = β€œeng” (default): Returns English column names and labels
  • language = β€œpt”: Returns Portuguese column names and labels

Data sources

All data are retrieved from official Brazilian institutions:

  • Central Bank of Brazil (BCB) via the SGS API

Contribution

Suggestions, feature requests, and pull requests are welcome!

Metadata

Version

0.8.0

License

Unknown

PlatformsΒ (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows