Learn R Programming

rbcb (version 0.1.9)

get_market_expectations: Get market expectations

Description

General function to get statistics of market expectations. The API provides requests for annual, monthly, and quarterly expectations. Is is also proveided expectations for 12 months ahead, specific requests for the top 5 indicators for annual and monthly expectations and data provided by financial institutions.

Usage

get_market_expectations(
  type = c("annual", "quarterly", "monthly", "inflation-12-months", "top5s-monthly",
    "top5s-annual", "institutions"),
  indic = NULL,
  start_date = NULL,
  end_date = NULL,
  keep_names = TRUE,
  ...
)

Arguments

type

a character with one of the following: annual, quarterly monthly, inflation-12-months, top5s-monthly, top5s-annual, institutions.

indic

a character vector with economic indicators names. They are case sensitive and don't forget the accents.

start_date

series initial date. Accepts ISO character formated date and Date.

end_date

series final date. Accepts ISO character formated date and Date.

keep_names

if TRUE keeps the column names returned by the API (in portuguese), if FALSE the columns are renamed to standardized names (in english).

...

additional parameters to be passed to the API

type defines the API used to fetch data.

  • annual: refers to the API *Expectativas de Mercado Anuais* for annual market expectations

  • quarterly: refers to the API *Expectativas de Mercado Trimestrais* for quarterly market expectations

  • monthly: refers to the API *Expectativas de Mercado Mensais* for monthly market expectations

  • inflation-12-months: refers to the API *Expectativas de mercado para infla<U+00E7><U+00E3>o nos pr<U+00F3>ximos 12 meses* for market expectations of inflation indexes for the next 12 months.

  • top5s-monthly: refers to the API *Expectativas de mercado mensais para os indicadores do Top 5* for monthly market expectations of top 5 indicators

  • top5s-annual: refers to the API *Expectativas de mercado anuais para os indicadores do Top 5* for annual market expectations of top 5 indicators

  • institutions: refers to the API *Expectativas de mercado informadas pelas institui<U+00E7><U+00F5>es credenciadas* for market expectations sent by institutions

indic argument must be one of indicators listed in Details. Respecting the case, blank spaces and accents.

The ... is to be used with API's parameters. $top to specify the maximum number of rows to be returned, this returns the $top rows, in chronological order. $skip can be used to ignore the first rows. If provided $filter applies filters according to <https://olinda.bcb.gov.br/olinda/servico/ajuda>.

Value

A data.frame with the requested data.

Details

All statistics are computed based on expectations provided by many financial institutions in Brazil: banks, funds, risk managers, so on and so forth. These expections and its statistics are used to build the FOCUS Report weekly released by the Brazilian Central Bank.

There are market expectations available for the following indicators:

  • Balan<U+00E7>a Comercial

  • C<U+00E2>mbio

  • Conta corrente

  • D<U+00ED>vida bruta do governo geral

  • D<U+00ED>vida l<U+00ED>quida do setor p<U+00FA>blico

  • IGP-DI

  • IGP-M

  • INPC

  • Investimento direto no pa<U+00ED>s

  • IPA-DI

  • IPA-M

  • IPCA

  • IPCA Administrados

  • IPCA Alimenta<U+00E7><U+00E3>o no domic<U+00ED>lio

  • IPCA Bens industrializados

  • IPCA Livres

  • IPCA Servi<U+00E7>os

  • IPCA-15

  • IPC-FIPE

  • PIB Agropecu<U+00E1>ria

  • PIB Despesa de consumo da administra<U+00E7><U+00E3>o p<U+00FA>blica

  • PIB despesa de consumo das fam<U+00ED>lias

  • PIB Exporta<U+00E7><U+00E3>o de bens e servi<U+00E7>os

  • PIB Forma<U+00E7><U+00E3>o Bruta de Capital Fixo

  • PIB Importa<U+00E7><U+00E3>o de bens e servi<U+00E7>os

  • PIB Ind<U+00FA>stria

  • PIB Servi<U+00E7>os

  • PIB Total

  • Produ<U+00E7><U+00E3>o industrial

  • Resultado nominal

  • Resultado prim<U+00E1>rio

  • Selic

  • Taxa de desocupa<U+00E7><U+00E3>o

Check <https://olinda.bcb.gov.br/olinda/servico/Expectativas/versao/v1/documentacao> for more details

Examples

Run this code
# NOT RUN {
indic <- c("IPCA", "C<U+00E2>mbio")
x <- get_market_expectations("annual", indic, `$top` = 10)

x <- get_market_expectations("monthly", "Selic", `$top` = 20)

# get monthly expectations for top 5 indicators since 2021
x <- get_market_expectations("top5s-monthly", start_date = "2021-01-01")

# get annual expectations for top 5 indicators since 2021
x <- get_market_expectations("top5s-annual", `$top` = 20)

# get all inflation expectations for 12 months ahead starting on 2021-01
x <- get_market_expectations("inflation-12-months", start_date = "2021-01-01")

# get all IPCA expectations informed by financial institutions since 2020
x <- get_market_expectations("institutions", "IPCA", start_date = "2020-01-01")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab