Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 4 additions & 53 deletions ql/termstructures/volatility/swaption/swaptionvolcube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,59 +88,10 @@ namespace QuantLib {

Rate SwaptionVolatilityCube::atmStrike(const Date& optionD,
const Period& swapTenor) const {

// FIXME use a familyName-based index factory
if (swapTenor > shortSwapIndexBase_->tenor()) {
if (swapIndexBase_->exogenousDiscount()) {
return SwapIndex(swapIndexBase_->familyName(),
swapTenor,
swapIndexBase_->fixingDays(),
swapIndexBase_->currency(),
swapIndexBase_->fixingCalendar(),
swapIndexBase_->fixedLegTenor(),
swapIndexBase_->fixedLegConvention(),
swapIndexBase_->dayCounter(),
swapIndexBase_->iborIndex(),
swapIndexBase_->discountingTermStructure())
.fixing(optionD);
} else {
return SwapIndex(swapIndexBase_->familyName(),
swapTenor,
swapIndexBase_->fixingDays(),
swapIndexBase_->currency(),
swapIndexBase_->fixingCalendar(),
swapIndexBase_->fixedLegTenor(),
swapIndexBase_->fixedLegConvention(),
swapIndexBase_->dayCounter(),
swapIndexBase_->iborIndex())
.fixing(optionD);
}
} else {
if (shortSwapIndexBase_->exogenousDiscount()) {
return SwapIndex(shortSwapIndexBase_->familyName(),
swapTenor,
shortSwapIndexBase_->fixingDays(),
shortSwapIndexBase_->currency(),
shortSwapIndexBase_->fixingCalendar(),
shortSwapIndexBase_->fixedLegTenor(),
shortSwapIndexBase_->fixedLegConvention(),
shortSwapIndexBase_->dayCounter(),
shortSwapIndexBase_->iborIndex(),
shortSwapIndexBase_->discountingTermStructure())
.fixing(optionD);
} else {
return SwapIndex(shortSwapIndexBase_->familyName(),
swapTenor,
shortSwapIndexBase_->fixingDays(),
shortSwapIndexBase_->currency(),
shortSwapIndexBase_->fixingCalendar(),
shortSwapIndexBase_->fixedLegTenor(),
shortSwapIndexBase_->fixedLegConvention(),
shortSwapIndexBase_->dayCounter(),
shortSwapIndexBase_->iborIndex())
.fixing(optionD);
}
}
const SwapIndex* base = (swapTenor > shortSwapIndexBase_->tenor())
? swapIndexBase_.get()
: shortSwapIndexBase_.get();
return base->clone(swapTenor)->fixing(optionD);
}

}