InterpolatedYoYOptionletVolatilityCurve<Interpolator1D>:: InterpolatedYoYOptionletVolatilityCurve(Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter& dc, const Period &lag, Frequency frequency, bool indexIsInterpolated, const std::vector<Date> &d, const std::vector<Volatility> &v, Rate minStrike, Rate maxStrike, const Interpolator1D &i) : YoYOptionletVolatilitySurface(settlementDays, cal, bdc, dc, lag, frequency, indexIsInterpolated), InterpolatedCurve<Interpolator1D>(i), dates_(d), minStrike_(minStrike), maxStrike_(maxStrike) { QL_REQUIRE(d.size() == v.size(), "must have same number of dates and vols: " << d.size() << " vs " << v.size()); QL_REQUIRE(d.size() > 1, "must have at least two dates: " << d.size()); for (Size i = 0; i < d.size(); i++ ){ this->times_.push_back( this->timeFromReference(dates_[i]) ); this->data_.push_back(v[i]), nodes_.push_back( std::make_pair( dates_[i], this->data_[i]) ); } this->setupInterpolation(); // set the base vol level to that predicted by the interpolation // this is allowed by the extrapolation Time baseTime = this->timeFromReference(baseDate()); setBaseLevel(this->interpolation_(baseTime,true)); }
InterpolatedYoYOptionletVolatilityCurve<Interpolator1D>:: InterpolatedYoYOptionletVolatilityCurve(Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter& dc, const Period &lag, Frequency frequency, bool indexIsInterpolated, Rate minStrike, Rate maxStrike, Volatility baseYoYVolatility, const Interpolator1D &interpolator) : YoYOptionletVolatilitySurface(settlementDays, cal, bdc, dc, lag, frequency, indexIsInterpolated), interpolator_(interpolator), minStrike_(minStrike), maxStrike_(maxStrike) { // don't have the data yet except for the base volatility // must set to communicate with bootstrap setBaseLevel(baseYoYVolatility); }