download.TD.data: Downloads data of Brazilian government bonds directly from...

View source: R/gtdd_download_TD_data.R

download.TD.dataR Documentation

Downloads data of Brazilian government bonds directly from the website

Description

This function looks into the tesouro direto website (https://www.tesourodireto.com.br/) and downloads all of the files containing prices and yields of government bonds. You can use input asset.codes to restrict the downloads to specific bonds

Usage

download.TD.data(
  asset.codes = "LTN",
  dl.folder = get_cache_folder(),
  do.clean.up = FALSE,
  do.overwrite = FALSE,
  n.dl = NULL
)

Arguments

asset.codes

Strings that identify the assets (1 or more assets) in the names of the excel files. E.g. asset.codes = 'LTN'. When set to NULL, it will download all available assets

dl.folder

Name of folder to save excel files from tesouro direto (will create if it does not exists)

do.clean.up

Clean up folder before downloading? (TRUE or FALSE)

do.overwrite

Overwrite excel files? (TRUE or FALSE). If FALSE, will only download the new data for the current year

n.dl

Sets how many files to download from the website. Used only to decrease CRAN CHECK time. The default value is NULL (downloads all files)

Value

TRUE if successful

Examples

# only download file where string LTN is found
# (only 1 file for simplicity)
## Not run: 
download.TD.data(asset.codes = 'LTN', n.dl = 1)

## End(Not run)
# The excel file should be available in folder 'TD Files' (default name)


GetTDData documentation built on May 31, 2023, 8:06 p.m.