View source: R/get_selic_rate.R
| get_selic_rate | R Documentation |
Downloads the annual SELIC rate series from the Central Bank of Brazil's SGS API. The SELIC rate (Special System for Settlement and Custody) is Brazil's benchmark overnight interest rate, used as the primary monetary policy instrument.
get_selic_rate(
start_date = "2020-01-01",
end_date = NULL,
language = "eng",
labels = TRUE
)
start_date |
Start date for the data period. Accepts multiple formats:
|
end_date |
End date for the data period. Accepts the same formats as
|
language |
Language for column names in the returned data.frame:
|
labels |
Logical indicating whether to add variable labels using the |
A data.frame with SELIC rate. Columns depend on the language parameter:
English (language = "eng"): date (Date), selic_rate (numeric, % per year)
Portuguese (language = "pt"): data_referencia (Date), taxa_selic (numeric, % ao ano)
IMPORTANT API LIMITATION: The BCB API imposes a 10-year maximum window for daily frequency series like SELIC. Requests spanning more than 10 years will fail. For longer historical analyses, split your request into multiple 10-year periods.
DEFAULT PERIOD: When start_date = NULL, defaults to "2020-01-01" (start of 2020),
providing recent data while avoiding the 10-year API limit with current dates.
# Default: from 2020 to current date
df <- get_selic_rate()
# Specific period within 10-year limit
df2 <- get_selic_rate("2020-01-01", "2023-12-31")
# Last 5 years (respecting 10-year limit)
df3 <- get_selic_rate(start_date = "2019")
# Portuguese column names and labels
df4 <- get_selic_rate(language = "pt")
# Complete year analysis
df5 <- get_selic_rate("2018", "2023")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.