<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/brazilian-yield-curve/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://msperlin.github.io/2017-09-14-Brazilian-Yield-Curve/"> R and Finance</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The latest version of <code>GetTDData</code> offers function <code>get.yield.curve</code> to<br>
download the current Brazilian yield curve directly from<br>
<a rel="nofollow" href="http://www.anbima.com.br/est_termo/CZ.asp" target="_blank">Anbima</a>. The yield curve is<br>
a financial tool that shows how, based on current prices of fixed income<br>
instruments, the market perceives the future real, nominal and inflation<br>
returns. You can find more details regarding the use and definition of a<br>
yield curve in<br>
<a rel="nofollow" href="http://www.investopedia.com/terms/y/yieldcurve.asp" target="_blank">Investopedia</a>.</p>
<p>Unfortunately, function <code>get.yield.curve</code> only downloads the <strong>current</strong><br>
yield curve from the website. Data for historical curves over five<br>
business days are not available in Anbima website.</p>
<p>The new version of <code>GetTDData</code> is available in github:</p>
<div>
<pre><code>devtools::install_github('msperlin/GetTDData')
</code></pre>
</div>
<p>I just send the update to CRAN. It should be up in a couple of hours.<br>
You can install it with:</p>
<div>
<pre><code>install.packages('GetTDData')
</code></pre>
</div>
<h1>The current Brazilian yield curve</h1>
<p>Downloading the yield curve is easy, all you need is to call function<br>
<code>get.yield.curve</code> without any argument:</p>
<div>
<pre><code>library(GetTDData)

df.yield &lt;- get.yield.curve()  
str(df.yield)

## 'data.frame':    117 obs. of  5 variables:
##  $ n.biz.days  : num  252 378 504 630 756 ...
##  $ type        : chr  &quot;real_return&quot; &quot;real_return&quot; &quot;real_return&quot; &quot;real_return&quot; ...
##  $ value       : num  3.27 3.26 3.55 3.86 4.12 ...
##  $ ref.date    : Date, format: &quot;2018-05-23&quot; &quot;2018-09-26&quot; ...
##  $ current.date: Date, format: &quot;2017-09-13&quot; &quot;2017-09-13&quot; ...
</code></pre>
</div>
<p>The result is a dataframe in the long format containing data for the<br>
yield curve of real, nominal and inflation returns. Let’s plot it!</p>
<div>
<pre><code>library(ggplot2)

p &lt;- ggplot(df.yield, aes(x=ref.date, y = value) ) +
  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)  

## Warning: Removed 1 rows containing missing values (geom_point).
</code></pre>
</div>
<p><img alt="" src="https://i0.wp.com/msperlin.github.io/img/2017-09-14-Brazilian-Yield-Curve_files/figure-markdown_strict/unnamed-chunk-4-1.png?w=456" data-recalc-dims="1"></p>
<p>The expected inflation in Brazil seems to be stable. Market expectation<br>
is for an inflation around 5% a year in 2024. This level is quite low<br>
when compared to our<br>
<a rel="nofollow" href="https://tradingeconomics.com/brazil/inflation-cpi" target="_blank">history</a>. As for<br>
future nominal interest rate, market expects another drop in the<br>
interest rate level in 2018. This is in line with the latest report from<br>
<a rel="nofollow" href="http://www.bcb.gov.br/?ATACOPOM" target="_blank">COPOM</a>, the Brazilian comittee of<br>
monetary policy. Real returns also seems to be stable and low, around<br>
5%. Again, this is one of the lowest levels of real returns in our<br>
economy.</p>
<p>I’m very optimistic (and very biased as I love my country!) regarding<br>
the future of the Brazilian economy. I hope we can keep these low levels<br>
of interest rate and inflation in order to foment comsumption, jobs and<br>
overall economic well-being.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://msperlin.github.io/2017-09-14-Brazilian-Yield-Curve/"> R and Finance</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/-J8fpGWindc" height="1"></a></div>