yc_get: Fetches Yield Curve Data from B3

View source: R/scraper-yc.R

yc_getR Documentation

Fetches Yield Curve Data from B3

Description

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)

Usage

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

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.

Value

A dataframe/tibble with yield curve data

Examples

## Not run: 
df_yc <- yc_mget(first_date = Sys.Date() - 5, last_date = Sys.Date())
head(df_yc)

## End(Not run)
## Not run: 
df_yc <- yc_get(Sys.Date())
head(df_yc)

## End(Not run)
## Not run: 
df_yc_ipca <- yc_ipca_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date()
)
head(df_yc_ipca)

## End(Not run)
## Not run: 
df_yc_ipca <- yc_ipca_get(Sys.Date())
head(df_yc_ipca)

## End(Not run)
## Not run: 
df_yc_usd <- yc_usd_mget(
  first_date = Sys.Date() - 5,
  last_date = Sys.Date()
)
head(df_yc_usd)

## End(Not run)
## Not run: 
df_yc_usd <- yc_usd_get(Sys.Date())
head(df_yc_usd)

## End(Not run)

rb3 documentation built on April 14, 2023, 5:10 p.m.