What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

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

What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

cheng li

Hi All,

 

After using Quantlibxl to build the yield curve successfully, I am now planning to use the curve to price different bonds. Firstly I want to calculate the par coupon for an existing bond or a dummy bond, so that I can have a review on the par yield curve in current market. After scanning in the Quantlibxl doc, I found the function qlBondAtmRateFromYieldTermStructure may meet my purpose. The description of the function says it return “ATM rate implied by the given YieldTermStructure” which in my opinion is just the par coupon. However the actual returned value is very strange, the number can’t be the par coupon. I can’t guess what the returned value means. It is hard to describeit in the mail, so I attach a sample sheet which shows my problem.

 

In the sample sheet, firstly I set up a dummy curve with flat forward rates as 0.05. Then I built several bonds with different maturities starting just today. After that, by using qlBondAtmRateFromYieldTermStructure , I expected to get the par coupon with each bond( in this case, the number should be around 0.05). Unfortunately, the returned number doesn’t seem to be consistent with my assumption. Finally I rebuilt these bonds with the returned value and re-priced these bonds with the flat curve. The value is not equal to 100 as expected…

 

Does anyone have faced the same issue?

 

Regards,

Cheng


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

qlBondAtmRateFromYieldTermStructure_sample.rar (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

cheng li
After diving into the Quantlib source codes, I think I have found some reason why such behaviour occurs.   qlBondAtmRateFromYieldTermStructure seems based on the Qauntlib function CashFlows::atmRate. As far as I know, this function works only for coupon cash flows. Unfortunately for a bond there is a face amount payment at the expiry and this is totally ignored by the atmRate function. So that the implied ATM rate that the function returning is the level at which all the NPV of the coupon cash flows will be equal to the target clean price. This is not the usual logic from which we define the par rate. To get the expected par rate, I have to subtract the NPV of the final face amount payment from the target clean price and plug the adjusted clean price to the function    qlBondAtmRateFromYieldTermStructure .

2012/8/17 Cheng Li <[hidden email]>

Hi All,

 

After using Quantlibxl to build the yield curve successfully, I am now planning to use the curve to price different bonds. Firstly I want to calculate the par coupon for an existing bond or a dummy bond, so that I can have a review on the par yield curve in current market. After scanning in the Quantlibxl doc, I found the function qlBondAtmRateFromYieldTermStructure may meet my purpose. The description of the function says it return “ATM rate implied by the given YieldTermStructure” which in my opinion is just the par coupon. However the actual returned value is very strange, the number can’t be the par coupon. I can’t guess what the returned value means. It is hard to describeit in the mail, so I attach a sample sheet which shows my problem.

 

In the sample sheet, firstly I set up a dummy curve with flat forward rates as 0.05. Then I built several bonds with different maturities starting just today. After that, by using qlBondAtmRateFromYieldTermStructure , I expected to get the par coupon with each bond( in this case, the number should be around 0.05). Unfortunately, the returned number doesn’t seem to be consistent with my assumption. Finally I rebuilt these bonds with the returned value and re-priced these bonds with the flat curve. The value is not equal to 100 as expected…

 

Does anyone have faced the same issue?

 

Regards,

Cheng



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

Ferdinando M. Ametrano-3
Hi Cheng

> qlBondAtmRateFromYieldTermStructure seems based on the Qauntlib function
> CashFlows::atmRate.

yes it is

> As far as I know, this function works only for coupon cash flows.

No, it should work for whatever kind of bond, as it just looks for the
par fixed coupon that matches the npv of the actual bond's cashflow
stream

> Unfortunately for a bond there is a face amount payment at the expiry and this is totally
> ignored by the atmRate function.

the atmRate function just deals with cashflows, it is not aware about
them being redemptions or coupons

> So that the implied ATM rate that the function returning
> is the level at which all the NPV of the coupon cash flows will be equal to the target
> clean price. This is not the usual logic from which we define the par rate.

you're right, this is not usual logic and it is not the expected
behavior, since  CashFlows::atmRate is passed bond.cashflows() which
should include redemption(s).
I think you stumbled into a genuine bug, which I will investigate as
soon as I can

ciao -- Nando

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

Ferdinando M. Ametrano-3
Hi Cheng

> you stumbled into a genuine bug, which I will investigate as
> soon as I can

I fixed the bug on the R01020x-branch, update the source code or wait
for the forthcoming 1.2.1 release

ciao -- Nando

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

Ferdinando M. Ametrano-3
btw you might find interesting the revisited version of your original
Excel work.

ciao -- Nando

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

qlBondAtmRateFromYieldTermStructure.xls (85K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

答复: What is the behavior of the function qlBondAtmRateFromYieldTermStructure?

cheng li
In reply to this post by Ferdinando M. Ametrano-3
Hi Nando,

So much thanks. I'll update to that branch as soon as possible.. Currently
much of my project heavily depends on Quantlib project. I can't imagine how
I can live without the great gift you and all the other quantlib developers
bring to us. Thank you all very much.

Regards,
Cheng

-----邮件原件-----
发件人: [hidden email] [mailto:[hidden email]]
代表 Ferdinando Ametrano
发送时间: 2012年8月30日 21:29
收件人: Cheng Li
抄送: [hidden email]
主题: Re: [Quantlib-users] What is the behavior of the function
qlBondAtmRateFromYieldTermStructure?

Hi Cheng

> you stumbled into a genuine bug, which I will investigate as soon as I
> can

I fixed the bug on the R01020x-branch, update the source code or wait for
the forthcoming 1.2.1 release

ciao -- Nando


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

OIS rate helper with exogenous discount curve

Roland Lichters-2
In reply to this post by Ferdinando M. Ametrano-3
Hi Nando, all,

are there any objections to extend the OIS rate helper as attached, i.e. to have an optional exogenous discount curve handle, following the swap rate helper example? We have come across a use case where this would help, i.e. stripping consistent "foreign currency" discount curves when collateral is "domestic" currency.

If there are no objections, the attached could replace the current oisratehalper.*pp without breaking regression.

Kind regards,
Roland  

PS: If there are doubts about the use case I'd be interested to discuss.






------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

oisratehelper2.cpp (5K) Download Attachment
oisratehelper2.hpp (3K) Download Attachment