|
From: Peter C. <pca...@gm...> - 2012-11-03 18:09:40
|
Hi,
I think the in arrears adjustment in couponpricer.cpp is computed
slightly wrong. Shouldn't it be like in the adjusted code below?
Thanks, Peter
ql/cashflows/couponpricer.cpp
// see Hull, 4th ed., page 550
QL_REQUIRE(!capletVolatility().empty(),
"missing optionlet volatility");
Date d1 = coupon_->fixingDate(),
+ d2 = coupon_->index()->valueDate(d1),
referenceDate = capletVolatility()->referenceDate();
if (d1 <= referenceDate) {
adjustement = 0.0;
} else {
- Date d2 = coupon_->index()->maturityDate(d1);
- Time tau =
coupon_->index()->dayCounter().yearFraction(d1, d2);
+ Date d3 = coupon_->index()->maturityDate(d2);
+ Time tau =
coupon_->index()->dayCounter().yearFraction(d2, d3);
Real variance = capletVolatility()->blackVariance(d1,
fixing);
adjustement = fixing*fixing*variance*tau/(1.0+fixing*tau);
}
|