Login  Register

Strange behavior of dirtyPriceFromYield

classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Strange behavior of dirtyPriceFromYield

Piter Dias-2
Guys,

I am a bit confused with the dirtyPriceFromYield piece of code bellow.
It seems that even if I set Compounding to Simple the yield will be
compounded coupon by coupon.
Is it make sense?
Why don´t we calculate discount factor always from settlement to couponDate?
This way Compounding setup would be followed and a fixed coupon bond would
have the same behavior of a portfolio of zero coupon ones.

What do you guys thing about?

Regards,

Piter Dias
[hidden email]

//##########################################################################

                if (lastDate == Date()) {
                    // first not-expired coupon
                    if (i > 0) {
                        lastDate = cashflows[i-1]->date();
                    } else {
                        boost::shared_ptr<Coupon> coupon =
                            boost::dynamic_pointer_cast<Coupon>(cashflows[i]);
                        if (coupon)
                            lastDate = coupon->accrualStartDate();
                        else
                            lastDate = couponDate - 1*Years;
                    }
                    discount *= y.discountFactor(settlement,couponDate,
                                                 lastDate, couponDate);
                } else  {
                    discount *= y.discountFactor(lastDate, couponDate);
                }

//##########################################################################



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev