Yield curve generated using Treasury considerably higher than the curve by DOT

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Yield curve generated using Treasury considerably higher than the curve by DOT

hudsoncity
The yield curved is generated using 4,13,26, and 52 weeks T-bills, and 2,3,5,7, and 10 year T-notes, and 30 year T-bond that are published in treasurydirect.com. The code is pretty much a knockoff of the bonds.cpp. The curve produced by the code using the treasury from the treasurydirect.com is considerably higher than the Treasury Curve in http://www.treasury.gov/resource-center/data-chart-center/Pages/index.aspx. I checked the calender, daycounter, settlement date, and etc, and they seem fine to me. It would be appreciated if someone could help me to identify the problem.
 
The significant discrepancy between the two curves prevents me from using the 20 year composite rate, because it is considerably smaller than that in the curve I generated. Without using the 20 year composite rate, the long-term portion of the curve will be concave instead convex as shown in the Treasury Curve. 
 
Thanks

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Yield curve generated using Treasury considerably higher than the curve by DOT

hudsoncity
sorry, forgot to attached the files

From: song xu <[hidden email]>
To: "[hidden email]" <[hidden email]>
Sent: Tuesday, April 23, 2013 12:16 AM
Subject: Yield curve generated using Treasury considerably higher than the curve by DOT

The yield curved is generated using 4,13,26, and 52 weeks T-bills, and 2,3,5,7, and 10 year T-notes, and 30 year T-bond that are published in treasurydirect.com. The code is pretty much a knockoff of the bonds.cpp. The curve produced by the code using the treasury from the treasurydirect.com is considerably higher than the Treasury Curve in http://www.treasury.gov/resource-center/data-chart-center/Pages/index.aspx. I checked the calender, daycounter, settlement date, and etc, and they seem fine to me. It would be appreciated if someone could help me to identify the problem.
 
The significant discrepancy between the two curves prevents me from using the 20 year composite rate, because it is considerably smaller than that in the curve I generated. Without using the 20 year composite rate, the long-term portion of the curve will be concave instead convex as shown in the Treasury Curve. 
 
Thanks



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

code.txt (14K) Download Attachment
curve.xlsx (130K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Yield curve generated using Treasury considerably higher than the curve by DOT

Allen Kuo-2
my guesses:

1. you're printing out zero rates whereas the treasury [hidden email] is a yield (to maturity) curve.  You probably want to print out a par rates. Not sure there is a direct method for that anymore but can back that out using the discount curve.  See: http://quantlib.org/reference/_fitted_bond_curve_8cpp-example.html

2. The methodology of building the curves is different. Treasury appears to be taking select bond YTMs and interpolating to get values for the key points (e.g. 2,3,5,7,10, 30). Then it takes those key YTM points and uses a "quasi-cubic hermite spline algorithm" to get other points on their yield (to maturity) curve (which should be close to  par curve). 

To do what treasury does (to directly fit yields), I think you'd have to do something along the lines of:
http://quantlib.org/quep/quep003/CurveFitting_8cpp-source.html 


On 4/23/2013 12:19 PM, song xu wrote:
sorry, forgot to attached the files

From: song xu [hidden email]
To: [hidden email] [hidden email]
Sent: Tuesday, April 23, 2013 12:16 AM
Subject: Yield curve generated using Treasury considerably higher than the curve by DOT

The yield curved is generated using 4,13,26, and 52 weeks T-bills, and 2,3,5,7, and 10 year T-notes, and 30 year T-bond that are published in treasurydirect.com. The code is pretty much a knockoff of the bonds.cpp. The curve produced by the code using the treasury from the treasurydirect.com is considerably higher than the Treasury Curve in http://www.treasury.gov/resource-center/data-chart-center/Pages/index.aspx. I checked the calender, daycounter, settlement date, and etc, and they seem fine to me. It would be appreciated if someone could help me to identify the problem.
 
The significant discrepancy between the two curves prevents me from using the 20 year composite rate, because it is considerably smaller than that in the curve I generated. Without using the 20 year composite rate, the long-term portion of the curve will be concave instead convex as shown in the Treasury Curve. 
 
Thanks




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr


_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Yield curve generated using Treasury considerably higher than the curve by DOT

hudsoncity
Thank you Allen. I got it. Basically I need to print out the discount rate and then use the discount rate to calculate the par rate, which close to Treasury yield curve.
 
One thing I realized is that I have to use 20 year composite rate to make the curve make sense for the long-term section. Is there any coupon bond of which YTM is 20 year composite rate used by the Treasury when they make their yield curve? Otherwise, using key rates may be the only way to leverage the 20 year composite rate.
 
Regards,
Song

From: Allen Kuo <[hidden email]>
To: song xu <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Thursday, April 25, 2013 7:24 AM
Subject: Re: [Quantlib-users] Yield curve generated using Treasury considerably higher than the curve by DOT

my guesses:

1. you're printing out zero rates whereas the treasury [hidden email] is a yield (to maturity) curve.  You probably want to print out a par rates. Not sure there is a direct method for that anymore but can back that out using the discount curve.  See: http://quantlib.org/reference/_fitted_bond_curve_8cpp-example.html

2. The methodology of building the curves is different. Treasury appears to be taking select bond YTMs and interpolating to get values for the key points (e.g. 2,3,5,7,10, 30). Then it takes those key YTM points and uses a "quasi-cubic hermite spline algorithm" to get other points on their yield (to maturity) curve (which should be close to  par curve). 

To do what treasury does (to directly fit yields), I think you'd have to do something along the lines of:
http://quantlib.org/quep/quep003/CurveFitting_8cpp-source.html 


On 4/23/2013 12:19 PM, song xu wrote:
sorry, forgot to attached the files

From: song xu [hidden email]
To: [hidden email] [hidden email]
Sent: Tuesday, April 23, 2013 12:16 AM
Subject: Yield curve generated using Treasury considerably higher than the curve by DOT

The yield curved is generated using 4,13,26, and 52 weeks T-bills, and 2,3,5,7, and 10 year T-notes, and 30 year T-bond that are published in treasurydirect.com. The code is pretty much a knockoff of the bonds.cpp. The curve produced by the code using the treasury from the treasurydirect.com is considerably higher than the Treasury Curve in http://www.treasury.gov/resource-center/data-chart-center/Pages/index.aspx. I checked the calender, daycounter, settlement date, and etc, and they seem fine to me. It would be appreciated if someone could help me to identify the problem.
 
The significant discrepancy between the two curves prevents me from using the 20 year composite rate, because it is considerably smaller than that in the curve I generated. Without using the 20 year composite rate, the long-term portion of the curve will be concave instead convex as shown in the Treasury Curve. 
 
Thanks




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr


_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users