Real BlackIborCouponPricer::optionletPrice(Option::Type optionType, Real effStrike) const { Date fixingDate = coupon_->fixingDate(); if (fixingDate <= Settings::instance().evaluationDate()) { // the amount is determined Real a, b; if (optionType==Option::Call) { a = coupon_->indexFixing(); b = effStrike; } else { a = effStrike; b = coupon_->indexFixing(); } return std::max(a - b, 0.0)* accrualPeriod_*discount_; } else { // not yet determined, use Black model QL_REQUIRE(!capletVolatility().empty(), "missing optionlet volatility"); Real stdDev = std::sqrt(capletVolatility()->blackVariance(fixingDate, effStrike)); Real shift = capletVolatility()->displacement(); bool shiftedLn = capletVolatility()->volatilityType() == ShiftedLognormal; Rate fixing = shiftedLn ? blackFormula(optionType, effStrike, adjustedFixing(), stdDev, 1.0, shift) : bachelierBlackFormula(optionType, effStrike, adjustedFixing(), stdDev, 1.0); return fixing * accrualPeriod_ * discount_; } }
Real CPICouponPricer::optionletPrice(Option::Type optionType, Real effStrike) const { Date fixingDate = coupon_->fixingDate(); if (fixingDate <= Settings::instance().evaluationDate()) { // the amount is determined Real a, b; if (optionType==Option::Call) { a = coupon_->indexFixing(); b = effStrike; } else { a = effStrike; b = coupon_->indexFixing(); } return std::max(a - b, 0.0)* coupon_->accrualPeriod()*discount_; } else { // not yet determined, use Black/DD1/Bachelier/whatever from Impl QL_REQUIRE(!capletVolatility().empty(), "missing optionlet volatility"); Real stdDev = std::sqrt(capletVolatility()->totalVariance(fixingDate, effStrike)); Rate fixing = optionletPriceImp(optionType, effStrike, adjustedFixing(), stdDev); return fixing * coupon_->accrualPeriod() * discount_; } }
Rate CPICouponPricer::swapletRate() const { // This way we do not require the index to have // a yield curve, i.e. we do not get the problem // that a discounting-instrument-pricer is used // with a different yield curve //std::cout << (gearing_ * adjustedFixing() + spread_) << " SWAPLET rate" << gearing_ << " " << spread_ << std::endl; return gearing_ * adjustedFixing() + spread_; }
Real CPICouponPricer::swapletPrice() const { Real swapletPrice = adjustedFixing() * coupon_->accrualPeriod() * discount_; //std::cout << swapletPrice << " SWAPLET price" << std::endl; return gearing_ * swapletPrice + spreadLegValue_; }
inline Rate FloatingRateCoupon::convexityAdjustmentImpl(Rate fixing) const { return (gearing() == 0.0 ? 0.0 : adjustedFixing()-fixing); }
inline Real BlackIborCouponPricer::swapletPrice() const { // past or future fixing is managed in InterestRateIndex::fixing() Real swapletPrice = adjustedFixing() * accrualPeriod_ * discount_; return gearing_ * swapletPrice + spreadLegValue_; }