21#include <ql/utilities/dataformatters.hpp>
23#include <boost/algorithm/cxx11/is_sorted.hpp>
25using boost::algorithm::is_strictly_increasing;
30 const QuantLib::ext::shared_ptr<StrippedOptionletBase>& s)
31 : referenceDate_(referenceDate), calendar_(s->calendar()), businessDayConvention_(s->businessDayConvention()),
32 optionletDates_(s->optionletFixingDates()), nOptionletDates_(s->optionletMaturities()),
33 optionletTimes_(s->optionletFixingTimes()), optionletStrikes_(nOptionletDates_, vector<Rate>()),
34 optionletVolatilities_(nOptionletDates_, vector<Volatility>()), optionletAtmRates_(s->atmOptionletRates()),
35 dayCounter_(s->dayCounter()), type_(s->volatilityType()), displacement_(s->displacement()) {
45 BusinessDayConvention bdc,
const vector<Date>& optionletDates,
46 const vector<vector<Rate> >&
strikes,
47 const vector<vector<Volatility> >& volatilities,
48 const vector<Rate>& optionletAtmRates,
const DayCounter& dayCounter,
49 VolatilityType type, Real displacement)
50 : referenceDate_(referenceDate), calendar_(calendar), businessDayConvention_(bdc), optionletDates_(optionletDates),
51 nOptionletDates_(optionletDates.size()), optionletTimes_(nOptionletDates_), optionletStrikes_(
strikes),
52 optionletVolatilities_(volatilities), optionletAtmRates_(optionletAtmRates), dayCounter_(dayCounter), type_(type),
53 displacement_(displacement) {
63 QL_REQUIRE(!
optionletDates_.empty(),
"Need at least one optionlet to create optionlet surface");
65 "Mismatch between number of option tenors (" <<
nOptionletDates_ <<
") and number of volatility rows ("
74 "First option date (" <<
optionletDates_[0] <<
") must be greater than the reference date");
76 "Optionlet dates must be sorted in ascending order");
79 QL_REQUIRE(!
optionletStrikes_[i].empty(),
"The " << io::ordinal(i) <<
" row of strikes is empty");
81 "Size of " << io::ordinal(i) <<
" row of strikes and volatilities are not equal");
83 "The " << io::ordinal(i) <<
" row of strikes is not sorted in ascending order");
89 "index (" << i <<
") must be less than optionletStrikes size (" <<
optionletStrikes_.size() <<
")");
94 QL_REQUIRE(i <
optionletVolatilities_.size(),
"index (" << i <<
") must be less than optionletVolatilities size ("
DatedStrippedOptionlet(const Date &referenceDate, const QuantLib::ext::shared_ptr< StrippedOptionletBase > &s)
Construct from a StrippedOptionletBase object.
vector< Rate > optionletAtmRates_
const vector< Date > & optionletFixingDates() const override
vector< Time > optionletTimes_
const vector< Rate > & optionletStrikes(Size i) const override
const Date & referenceDate() const override
const vector< Time > & optionletFixingTimes() const override
const vector< Volatility > & optionletVolatilities(Size i) const override
VolatilityType volatilityType() const override
vector< vector< Volatility > > optionletVolatilities_
const Calendar & calendar() const override
const DayCounter & dayCounter() const override
const vector< Rate > & atmOptionletRates() const override
vector< Date > optionletDates_
BusinessDayConvention businessDayConvention() const override
Real displacement() const override
Size optionletMaturities() const override
vector< vector< Rate > > optionletStrikes_
BusinessDayConvention businessDayConvention_
Stripped optionlet surface with fixed reference date.