Title: | Get Data for Brazilian Bonds (Tesouro Direto) |
Version: | 1.5.7 |
Description: | Downloads and aggregates data for Brazilian government issued bonds directly from the website of Tesouro Direto https://www.tesourodireto.com.br/. |
Depends: | R (≥ 4.1.0) |
Imports: | stringr, readxl, utils, stats, curl, bizdays, tidyr, rvest, xml2, dplyr, fs, cli, purrr, tibble, jsonlite |
License: | MIT + file LICENSE |
BugReports: | https://github.com/msperlin/GetTDData/issues/ |
URL: | https://github.com/msperlin/GetTDData/, https://msperlin.github.io/GetTDData/ |
RoxygenNote: | 7.3.2 |
Encoding: | UTF-8 |
Suggests: | knitr, rmarkdown, testthat, ggplot2, covr, lubridate |
NeedsCompilation: | no |
Packaged: | 2025-05-19 12:05:04 UTC; msperlin |
Author: | Marcelo Perlin [aut, cre] |
Maintainer: | Marcelo Perlin <marceloperlin@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-05-19 12:40:02 UTC |
Gets the current yield curve
Description
Downloads and parses information about the current Brazilian yield curve.
Usage
get.yield.curve()
Value
A dataframe with information about the yield curve
Examples
## Not run:
df.yield <- get.yield.curve()
str(df.yield)
## End(Not run)
Returns cache directory
Description
Returns cache directory
Usage
get_cache_folder()
Value
a path
Examples
get_cache_folder()
Returns available nammes at TD site
Description
Returns available nammes at TD site
Usage
get_td_names()
Value
string vector
Examples
get_td_names()
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
td_get(
asset_codes = "LTN",
first_year = 2005,
last_year = as.numeric(format(Sys.Date(), "%Y")),
dl_folder = get_cache_folder()
)
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 |
first_year |
first year of data (minimum of 2015) |
last_year |
first year of data |
dl_folder |
Name of folder to save excel files from tesouro direto (will create if it does not exists) |
Value
TRUE if successful
Examples
## Not run:
td_get("LTN", 2020, 2022)
## End(Not run)
Returns current TD prices
Description
Fetches current prices of TD assets from website's json api at <https://www.tesourodireto.com.br/titulos/precos-e-taxas.htm>
Usage
td_get_current()
Value
a dataframe with prices
Examples
## Not run:
td_get_current()
## End(Not run)