| get_ibovespa | R Documentation |
Downloads the daily closing level of the Ibovespa (Índice Bovespa), Brazil's
main stock market benchmark, via Yahoo Finance (ticker ^BVSP). Uses the
yfR package, the same data source already used in the {brstocks}
package, so {brfinance} now covers the equity side alongside its
macroeconomic series.
get_ibovespa(
start_date = NULL,
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 the |
labels |
Logical indicating whether to add variable labels using the
|
A data.frame with columns:
Trading date
Ibovespa closing level (index points)
Requires the yfR package (install.packages("yfR")) and an internet
connection to Yahoo Finance. Unlike get_*() functions backed by BCB/SGS,
this one is not subject to the 10-year window limit — yfR handles the
full request in one call.
if (requireNamespace("yfR", quietly = TRUE)) {
# Default: last 30 days
df <- get_ibovespa()
# Specific period
df2 <- get_ibovespa("2020-01-01", "2023-12-31")
# Portuguese labels
df3 <- get_ibovespa(language = "pt")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.