Re: strange bond behavior??

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/strange-bond-behavior-tp4348p4352.html

On 1/12/06, [hidden email] <[hidden email]> wrote:

> Hi, I noticed some strange behavior with the bond FixedCouponBond
> class. When outputing the cashflows, the first coupon is wrong.
> Here is my simple python code that demonstrate the problem. Thanks a lot
> for your attention!
>
> from QuantLib import *
>
> calendar = UnitedStates()
> settlementDays = 1
> issue = Date(15,11,2005)
> d1 = Date(1,12,2005)
> mat = Date(15,11, 2010)
> coupon = [1, 0.1]
> bond = FixedCouponBond(issue, d1, mat, settlementDays, coupon, Annual,
> Thirty360(), calendar)
> flows = bond.cashflows()
> for item in flows:
>     print item.date(), item.amount()
>
> output:
>
> November 15th, 2006 95.5555555556
> November 15th, 2007 10.0
> November 17th, 2008 10.0555555556
> November 16th, 2009 9.97222222222
> November 15th, 2010 9.97222222222

In what sense is wrong? If you're referring to the large amount, it's
because you defined the coupons as:

> coupon = [1, 0.1]

which means that the first coupon is 100% and the following are 10%.
If it's referring to dates or day counts, it might be some convention
to set. what did you expect?

Later,
    Luigi