28 const std::vector<Period>& optionTenors,
29 const std::vector<Period>& swapTenors,
35 nOptionTenors_(optionTenors.size()),
36 optionTenors_(optionTenors),
37 optionDates_(nOptionTenors_),
38 optionTimes_(nOptionTenors_),
39 optionDatesAsReal_(nOptionTenors_),
40 optionInterpolatorTimes_(nOptionTenors_ + 1),
41 optionInterpolatorDatesAsReal_(nOptionTenors_ + 1),
42 nSwapTenors_(swapTenors.size()),
43 swapTenors_(swapTenors),
44 swapLengths_(nSwapTenors_) {
61 const std::vector<Period>& optionTenors,
62 const std::vector<Period>& swapTenors,
63 const Date& referenceDate,
68 nOptionTenors_(optionTenors.size()),
69 optionTenors_(optionTenors),
70 optionDates_(nOptionTenors_),
71 optionTimes_(nOptionTenors_),
72 optionDatesAsReal_(nOptionTenors_),
73 optionInterpolatorTimes_(nOptionTenors_ + 1),
74 optionInterpolatorDatesAsReal_(nOptionTenors_ + 1),
75 nSwapTenors_(swapTenors.size()),
76 swapTenors_(swapTenors),
77 swapLengths_(nSwapTenors_) {
93 const std::vector<Date>& optionDates,
94 const std::vector<Period>& swapTenors,
95 const Date& referenceDate,
100 nOptionTenors_(optionDates.size()),
101 optionTenors_(nOptionTenors_),
102 optionDates_(optionDates),
103 optionTimes_(nOptionTenors_),
104 optionDatesAsReal_(nOptionTenors_),
105 optionInterpolatorTimes_(nOptionTenors_ + 1),
106 optionInterpolatorDatesAsReal_(nOptionTenors_ + 1),
107 nSwapTenors_(swapTenors.size()),
108 swapTenors_(swapTenors),
109 swapLengths_(nSwapTenors_) {
127 ") must be greater than reference date (" << reference <<
")");
130 "non increasing option dates: " <<
io::ordinal(i) <<
138 "first option tenor is negative (" <<
142 "non increasing option tenor: " <<
io::ordinal(i) <<
149 "first swap tenor is negative (" <<
Date::serial_type serialNumber() const
Linear interpolation between discrete points
std::vector< Date > optionDates_
void initializeSwapLengths() const
void performCalculations() const override
std::vector< Period > swapTenors_
SwaptionVolatilityDiscrete(const std::vector< Period > &optionTenors, const std::vector< Period > &swapTenors, Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, const DayCounter &dc)
std::vector< Time > swapLengths_
void initializeOptionTimes() const
std::vector< Real > optionDatesAsReal_
void checkSwapTenors() const
Date cachedReferenceDate_
std::vector< Time > optionTimes_
Interpolation optionInterpolator_
std::vector< Time > optionInterpolatorTimes_
void checkOptionTenors() const
std::vector< Period > optionTenors_
std::vector< Real > optionInterpolatorDatesAsReal_
void initializeOptionDatesAndTimes() const
void checkOptionDates(const Date &reference) const
Swaption-volatility structure
Time swapLength(const Period &swapTenor) const
implements the conversion between swap tenor and swap (time) length
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Time timeFromReference(const Date &date) const
date/time conversion
Date optionDateFromTenor(const Period &) const
period/date conversion
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
BusinessDayConvention
Business Day conventions.
detail::ordinal_holder ordinal(Size)
outputs naturals as 1st, 2nd, 3rd...
unsigned QL_INTEGER Natural
positive integer
std::size_t Size
size of a container
linear interpolation between discrete points
Discretized swaption volatility.