|
From: Piter D. <pit...@ca...> - 2007-06-09 14:03:16
|
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
pit...@ca...
//##########################################################################
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);
}
//##########################################################################
|