Downloads yield curve data from B3 website https://www2.bmf.com.br/pages/portal/bmfbovespa/lumis/lum-taxas-referenciais-bmf-ptBR.asp. Particularly, we import data for

  • DI X Pre (yc_get)

  • Cupom limpo (yc_usd_get)

  • DI x IPCA (yc_ipca_get)

yc_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date(),
  by = 1,
  cache_folder = cachedir(),
  do_cache = TRUE
)

yc_get(refdate = Sys.Date(), cache_folder = cachedir(), do_cache = TRUE)

yc_ipca_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date(),
  by = 1,
  cache_folder = cachedir(),
  do_cache = TRUE
)

yc_ipca_get(refdate = Sys.Date(), cache_folder = cachedir(), do_cache = TRUE)

yc_usd_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date(),
  by = 1,
  cache_folder = cachedir(),
  do_cache = TRUE
)

yc_usd_get(refdate = Sys.Date(), cache_folder = cachedir(), do_cache = TRUE)

Arguments

first_date

First date ("YYYY-MM-DD") to yc_mget multiple curves

last_date

Last date ("YYYY-MM-DD") to yc_mget multiple curves

by

Number of days in between fetched dates (default = 1) in yc_mget

cache_folder

Location of cache folder (default = cachedir())

do_cache

Whether to use cache or not (default = TRUE)

refdate

Specific date ("YYYY-MM-DD") to yc_get single curve

Value

A dataframe/tibble with yield curve data

Details

See https://www.b3.com.br/data/files/8B/F5/11/68/5391F61043E561F6AC094EA8/Manual_de_Curvas.pdf for more details.

yc_get returns the yield curve for the given date and yc_mget returns multiple yield curves for a given range of dates.

yc_ipca_get returns the yield curve of real interest rates for the given date and yc_ipca_mget returns multiple yield curves of real interest rates for a given range of dates. These real interest rates consider IPCA as its inflation index.

yc_usd_get returns the yield curve of nominal interest rates for USD in Brazil for the given date and yc_usd_mget returns multiple yield curves of nominal interest rates for USD in Brazil for a given range of dates. These real interest rates consider IPCA as its inflation index.

Examples

if (FALSE) {
df_yc <- yc_mget(first_date = Sys.Date() - 5, last_date = Sys.Date())
head(df_yc)
}
if (FALSE) {
df_yc <- yc_get(Sys.Date())
head(df_yc)
}
if (FALSE) {
df_yc_ipca <- yc_ipca_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date()
)
head(df_yc_ipca)
}
if (FALSE) {
df_yc_ipca <- yc_ipca_get(Sys.Date())
head(df_yc_ipca)
}
if (FALSE) {
df_yc_usd <- yc_usd_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date()
)
head(df_yc_usd)
}
if (FALSE) {
df_yc_usd <- yc_usd_get(Sys.Date())
head(df_yc_usd)
}