Skip to contents

Retrieve market expectations from the Banco Central do Brasil Focus survey (Relatório Focus) via the Olinda API. Each row is the summary of survey responses collected on a given date for a future reference period.

Usage

bcb_expectations(
  type = "annual",
  indicator = NULL,
  start_date = NULL,
  end_date = NULL
)

Arguments

type

(character(1))
The forecast horizon. One of "annual", "monthly", or "quarterly". Default "annual".

indicator

(NULL | character(1))
The economic indicator to filter on (e.g. "IPCA", "Selic", "Câmbio"). If NULL, all indicators are returned. Default NULL.

start_date

(NULL | Date(1) | character(1))
Start of the survey date range (e.g., "2024-01-01"). If NULL, no lower bound is applied. Default NULL.

end_date

(NULL | Date(1) | character(1))
End of the survey date range, in the same format as start_date. If NULL, no upper bound is applied. Default NULL.

Value

A data.table::data.table() with columns date, indicator, detail, reference, mean, median, sd, min, max, respondents, and base.

Details

Querying without a filter returns the full history, which is large; supplying indicator and/or a date range is recommended.

Examples

# \donttest{
# annual IPCA inflation expectations
bcb_expectations("annual", "IPCA", start_date = "2024-01-01", end_date = "2024-01-31")
#>            date indicator detail reference   mean median     sd    min    max
#>          <Date>    <char> <char>    <char>  <num>  <num>  <num>  <num>  <num>
#>   1: 2024-01-02      IPCA   <NA>      2023 4.4689 4.4590 0.0767 4.2987 4.7148
#>   2: 2024-01-02      IPCA   <NA>      2024 3.8665 3.9000 0.3330 3.0198 5.2600
#>   3: 2024-01-02      IPCA   <NA>      2025 3.5669 3.5000 0.4053 2.4000 5.0000
#>   4: 2024-01-02      IPCA   <NA>      2026 3.5317 3.5000 0.4617 2.1000 5.0000
#>   5: 2024-01-02      IPCA   <NA>      2027 3.5317 3.5000 0.4717 2.5000 5.0100
#>  ---                                                                         
#> 216: 2024-01-31      IPCA   <NA>      2024 3.7777 3.8028 0.3256 2.9679 4.9475
#> 217: 2024-01-31      IPCA   <NA>      2025 3.5937 3.5042 0.3766 3.0000 5.0000
#> 218: 2024-01-31      IPCA   <NA>      2026 3.4945 3.5000 0.4097 2.8000 5.0000
#> 219: 2024-01-31      IPCA   <NA>      2027 3.4743 3.5000 0.4389 2.8000 5.0000
#> 220: 2024-01-31      IPCA   <NA>      2028 3.4460 3.4900 0.4419 3.0000 5.0000
#>      respondents  base
#>            <int> <int>
#>   1:         149     0
#>   2:         146     0
#>   3:         135     0
#>   4:         123     0
#>   5:         116     0
#>  ---                  
#> 216:         107     1
#> 217:         103     1
#> 218:          90     1
#> 219:          83     1
#> 220:          60     1
# }