Posted by
Matteo Zandi on
URL: http://quantlib.414.s1.nabble.com/Re-Net-yield-after-taxes-of-a-Bond-How-to-differentiate-on-cashflow-type-tp433p435.html
On Mon, Jan 3, 2011 at 4:31 PM, Luigi Ballabio
<[hidden email]> wrote:
You really want
calendar.advance(issue_date, settlement_days, QuantLib.Days)
instead.
ok, thanks for the tip. Maybe it needs to be fixed in python example bond.py also (line 41) where I took it.
However, that's likely not the problem. One is that, according to the
cashflows you reported, you want to pass Date(2,1,2011) to
bondYield--you're passing 2010 instead. This brings the yield to 3.82%,
which is more in line with what you're expecting.
Hem.. ok for 2011
Another issue might be your initial coupons:
03/01/2011 -96,39
02/05/2011 0,98
You're going to receive 1.5 on May 2nd, not 0.98, so that's what the
library will use for that date. The 0.52 accrued until now should be
included in the clean price passed to the bondYield method.
You're right, the bond works exactly like that but moving 0.52 from the first to the second payment doesn't change the rate of return (according to my calculations and Excel's XIRR function, 3rd decimal accuracy).
Is this what you mean by including the 0.52 accrued to the clean price?
bond.bondYield(96.39+0.52, day_counter, QuantLib.Compounded, QuantLib.Semiannual, QuantLib.Date(3,1,2011))
It lowers the yield to 3,7% which makes sense according to your previous 3,82% (cashflows are diminished by 0.52), but still differs from mine and excel's number (3,86%).
Thanks for the prompt answer and help,
Matteo
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users