The latest version of GetTDData
offers function
get.yield.curve
to download the current Brazilian yield
curve directly from Anbima. The yield curve is a tool of financial
analysts that show, based on current prices of fixed income instruments,
how the market perceives the future real, nominal and inflation returns.
You can find more details regarding the use and definition of a yield
curve in [Investopedia][https://www.investopedia.com/terms/y/yieldcurve.asp].
library(GetTDData)
<- get.yield.curve()
df.yield str(df.yield)
## 'data.frame': 117 obs. of 5 variables:
## $ n.biz.days : num 126 252 378 504 630 ...
## $ type : chr "real_return" "real_return" "real_return" "real_return" ...
## $ value : num 5.12 5.47 5.55 5.57 5.58 ...
## $ ref.date : Date, format: "2022-11-08" "2023-05-11" ...
## $ current.date: Date, format: "2022-05-10" "2022-05-10" ...
And we can plot it for the derised result:
library(ggplot2)
<- ggplot(df.yield, aes(x=ref.date, y = value) ) +
p geom_line(size=1) + geom_point() + facet_grid(~type, scales = 'free') +
labs(title = paste0('The current Brazilian Yield Curve '),
subtitle = paste0('Date: ', df.yield$current.date[1]))
print(p)