bcb_data: Fetch Banco Central do Brasil (BCB) data

View source: R/bcb.R

bcb_dataR Documentation

Fetch Banco Central do Brasil (BCB) data

Description

Retrieve time series data from the Banco Central do Brasil SGS (Sistema Gerenciador de Séries Temporais) API.

Usage

bcb_data(series, start_date = NULL, end_date = NULL)

Arguments

series

(integer(1))
The SGS series code to query (e.g., 1 for the USD/BRL exchange rate). Series codes can be found on the SGS website.

start_date

(NULL | Date(1) | character(1))
Start date of the data (e.g., "2024-01-01"). If NULL, all available data is returned. Default NULL.

end_date

(NULL | Date(1) | character(1))
End date of the data, in the same format as start_date. If NULL, data up to the latest available date is returned. Default NULL.

Details

Daily series require a date range and the API limits the query window to at most 10 years; supply start_date (and optionally end_date) when querying such series.

Value

A data.table::data.table() with the requested data.

Source

https://dadosabertos.bcb.gov.br/

See Also

Other data: banxico_data(), bbk_data(), bbk_series(), bcb_expectations(), bcb_fx_rates(), bcb_inflation(), bcb_selic(), bcb_top5(), bde_data(), bde_latest(), bdf_codelist(), bdf_data(), bdf_dataset(), bdp_data(), bis_data(), boc_data(), boe_data(), boi_data(), boj_data(), cnb_czeonia(), cnb_data(), cnb_fx_other_rates(), cnb_fx_rates(), cnb_pribor(), ecb_data(), nbp_fx_rates(), nbp_gold(), nob_data(), onb_data(), snb_data(), srb_cross_rates(), srb_data()

Examples



# fetch USD/BRL exchange rate
bcb_data(1, start_date = "2024-01-01", end_date = "2024-01-31")

# fetch the Selic target rate
bcb_data(432, start_date = "2024-01-01", end_date = "2024-01-31")



bbk documentation built on Aug. 28, 2026, 5:07 p.m.