The goal of meedr is to provide quick and easy access to market expectations data to the main macroeconomic indicators in the Focus report, made available by the Central Bank of Brazil through the Expectations System data API. This data comes from several financial institutions, such as: banks, brokers, funds, consultancies, etc.
The meedr package offers an R interface to the API and other advantages:
memoise
to speed up repeated
requests of data;Check the meedr pkgdown page for more general information ;)
You can install the released version of meedr from CRAN with:
install.packages("meedr")
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("schoulten/meedr")
These are some basic examples of using the package:
library(meedr)
# Monthly market expectations for IPCA indicator
ipca <- meedr::get_monthly(
indicator = "IPCA",
first_date = Sys.Date()-30,
reference_date = format(Sys.Date(), "%m/%Y"),
be_quiet = TRUE
)
head(ipca, 5)
#> # A tibble: 5 x 11
#> indicator date reference_date mean median sd coef_var min max
#> <chr> <date> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 IPCA 2021-07-16 07/2021 0.66 0.71 0.17 26.3 0.13 0.94
#> 2 IPCA 2021-07-16 07/2021 0.72 0.77 0.15 20.3 0.13 0.93
#> 3 IPCA 2021-07-15 07/2021 0.65 0.7 0.18 27.5 0.13 0.94
#> 4 IPCA 2021-07-15 07/2021 0.72 0.77 0.15 21.2 0.13 0.94
#> 5 IPCA 2021-07-14 07/2021 0.64 0.68 0.18 28.4 0.13 0.94
#> # ... with 2 more variables: n_respondents <int>, basis <int>
# Quarterly market expectations for GDP indicator
meedr::get_quarterly(
indicator = "PIB Total",
first_date = "2021-01-01",
reference_date = paste0(lubridate::quarter(Sys.Date()), "/", lubridate::year(Sys.Date())),
be_quiet = TRUE
)
# Annual market expectations for SELIC and exchange rate (BRL) indicator
meedr::get_annual(
indicator = c("Meta para taxa over-selic", "Taxa de câmbio"),
reference_date = format(Sys.Date(), "%Y"),
be_quiet = TRUE
)
# Inflation over the next 12 months
# First, and a suggestion, run this for using parallel computing:
future::plan(future::multisession, workers = floor(future::availableCores()/2))
meedr::get_inflation_12m(
indicator = c("IGP-DI", "IGP-M", "INPC", "IPA-DI", "IPA-M", "IPCA", "IPCA-15", "IPC-FIPE"),
smoothed = "yes",
be_quiet = FALSE, # display messages
do_parallel = TRUE # turn on parallel computing
)
# Monthly market expectations for IGP-M indicator (Top 5 Focus)
meedr::get_monthly_top5(
indicator = "IGP-M",
first_date = NULL, # get all data to current date
calc_type = "long",
be_quiet = TRUE
)
# Annual market expectations for SELIC indicator (Top 5 Focus)
meedr::get_annual_top5(
indicator = "Meta para taxa over-selic",
detail = "Fim do ano",
be_quiet = TRUE,
use_memoise = FALSE # disable caching system
)
Check out some similar works:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.