This function provides the extraction of data and statistics related to expectations of economic indicators, specifically Selic market expectations, made available by the Central Bank of Brazil's Expectations System through the Olinda API. The data comes from several financial institutions: banks, funds, research houses, etc. Important: arguments are case sensitive.

get_selic(
  indicator = "Selic",
  first_date = Sys.Date() - 2 * 365,
  last_date = Sys.Date(),
  meeting = NULL,
  be_quiet = FALSE,
  use_memoise = FALSE,
  do_parallel = FALSE
)

Arguments

indicator

A character vector with economic indicators names, see details for possible value. Defaults to "Selic".

first_date

A single string or Date in "YYYY-mm-dd" format. Default for 2 years prior to the current date.

last_date

A single string or Date in "YYYY-mm-dd" format. Default is the current date.

meeting

A single string in "RX/YYYY" format, where X is a positive integer, indicating the meeting for which the statistic is expected. Defaults to NULL.

be_quiet

Logical. Should messages or warnings not be displayed? Defaults to FALSE.

use_memoise

Logical. Sets the use of caching system, creating a folder named "cache_bcb" by default. Defaults to FALSE.

do_parallel

Logical. For using parallel data importation. Defaults to FALSE.

Value

A tibble with data from BCB-Olinda Data Services.

Details

For periods for which there are no statistics, they will be omitted from the query.

Possible values for indicator argument: 'Selic'.

Author

Fernando da Silva <fernando@fortietwo.com>

Examples

df1 <- get_selic(indicator = "Selic", first_date = Sys.Date() - 30)
#> 
#> Fetching [Selic] data from BCB-Olinda... 
#> 
#> Found 576 observations!
df1
#> # A tibble: 576 × 10
#>    indicator date       meeting  mean median    sd   min   max n_respond…¹ basis
#>    <chr>     <date>     <chr>   <dbl>  <dbl> <dbl> <dbl> <dbl>       <int> <int>
#>  1 Selic     2022-08-05 R5/2024  8.91    9   0.854   7    10            14     1
#>  2 Selic     2022-08-05 R5/2024  8.91    9   0.854   7    10            14     0
#>  3 Selic     2022-08-05 R4/2024  8.87    9   0.894   7    10.5          30     1
#>  4 Selic     2022-08-05 R4/2024  9.12    9   0.987   7    12.2         107     0
#>  5 Selic     2022-08-05 R3/2024  9.34    9.5 0.949   7.5  11            33     1
#>  6 Selic     2022-08-05 R3/2024  9.52    9.5 0.991   7.5  12.5         112     0
#>  7 Selic     2022-08-05 R2/2024  9.81   10   0.894   8    11.5          33     1
#>  8 Selic     2022-08-05 R2/2024  9.97   10   0.980   7.5  12.8         112     0
#>  9 Selic     2022-08-05 R1/2024 10.4    10.4 0.934   8.5  13            34     1
#> 10 Selic     2022-08-05 R1/2024 10.4    10.5 0.968   8.5  13           113     0
#> # … with 566 more rows, and abbreviated variable name ¹​n_respondents
#> # ℹ Use `print(n = ...)` to see more rows

df2 <- get_selic(indicator = "Selic", first_date = NULL, meeting = "R1/2024")
#> 
#> Fetching [Selic] data from BCB-Olinda... 
#> 
#> Found 254 observations!
df2
#> # A tibble: 254 × 10
#>    indicator date       meeting  mean median    sd   min   max n_respond…¹ basis
#>    <chr>     <date>     <chr>   <dbl>  <dbl> <dbl> <dbl> <dbl>       <int> <int>
#>  1 Selic     2022-08-05 R1/2024  10.4   10.4 0.934  8.5   13            34     1
#>  2 Selic     2022-08-05 R1/2024  10.4   10.5 0.968  8.5   13           113     0
#>  3 Selic     2022-08-04 R1/2024  10.5   10.5 0.933  8.5   12.5          63     1
#>  4 Selic     2022-08-04 R1/2024  10.4   10.5 0.954  8.5   13           113     0
#>  5 Selic     2022-08-03 R1/2024  10.5   10.5 1.04   7.25  13            64     1
#>  6 Selic     2022-08-03 R1/2024  10.4   10.5 0.990  7.25  13           113     0
#>  7 Selic     2022-08-02 R1/2024  10.5   10.5 1.06   7.25  13            67     1
#>  8 Selic     2022-08-02 R1/2024  10.4   10.5 0.990  7.25  13           113     0
#>  9 Selic     2022-08-01 R1/2024  10.5   10.5 1.07   7.25  13            70     1
#> 10 Selic     2022-08-01 R1/2024  10.4   10.5 0.989  7.25  13           113     0
#> # … with 244 more rows, and abbreviated variable name ¹​n_respondents
#> # ℹ Use `print(n = ...)` to see more rows