|
17 | 17 | */ |
18 | 18 |
|
19 | 19 | #include <qle/termstructures/blackvolsurfaceabsolute.hpp> |
| 20 | +#include <qle/math/flatextrapolation.hpp> |
20 | 21 |
|
21 | 22 | #include <ql/experimental/fx/blackdeltacalculator.hpp> |
22 | 23 | #include <ql/math/comparison.hpp> |
|
28 | 29 | namespace QuantExt { |
29 | 30 |
|
30 | 31 | BlackVolatilitySurfaceAbsolute::BlackVolatilitySurfaceAbsolute( |
31 | | - Date referenceDate, const std::vector<Date>& dates, |
32 | | - const std::vector<std::vector<Real>>& strikes, const std::vector<std::vector<Real>>& strikeQuotes, |
33 | | - const DayCounter& dayCounter, const Calendar& calendar, |
| 32 | + Date referenceDate, const std::vector<Date>& dates, const std::vector<std::vector<Real>>& strikes, |
| 33 | + const std::vector<std::vector<Real>>& strikeQuotes, const DayCounter& dayCounter, const Calendar& calendar, |
34 | 34 | const Handle<Quote>& spot, const Size spotDays, const Calendar spotCalendar, |
35 | 35 | const Handle<YieldTermStructure>& domesticTS, const Handle<YieldTermStructure>& foreignTS, |
36 | 36 | const DeltaVolQuote::DeltaType dt, const DeltaVolQuote::AtmType at, const Period& switchTenor, |
37 | | - const DeltaVolQuote::DeltaType ltdt, const DeltaVolQuote::AtmType ltat, const SmileInterpolation smileInterpolation) |
| 37 | + const DeltaVolQuote::DeltaType ltdt, const DeltaVolQuote::AtmType ltat, const SmileInterpolation smileInterpolation, |
| 38 | + const bool flatExtrapolation) |
38 | 39 | : BlackVolatilityTermStructure(referenceDate, calendar, Following, dayCounter), dates_(dates), strikes_(strikes), |
39 | | - strikeQuotes_(strikeQuotes), spot_(spot), spotDays_(spotDays), |
40 | | - spotCalendar_(spotCalendar), domesticTS_(domesticTS), foreignTS_(foreignTS), dt_(dt), at_(at), |
41 | | - switchTenor_(switchTenor), ltdt_(ltdt), ltat_(ltat), smileInterpolation_(smileInterpolation) { |
| 40 | + strikeQuotes_(strikeQuotes), spot_(spot), spotDays_(spotDays), spotCalendar_(spotCalendar), |
| 41 | + domesticTS_(domesticTS), foreignTS_(foreignTS), dt_(dt), at_(at), switchTenor_(switchTenor), ltdt_(ltdt), |
| 42 | + ltat_(ltat), smileInterpolation_(smileInterpolation), flatExtrapolation_(flatExtrapolation) { |
42 | 43 |
|
43 | 44 | // checks |
44 | 45 |
|
@@ -92,6 +93,10 @@ BlackVolatilitySurfaceAbsolute::BlackVolatilitySurfaceAbsolute( |
92 | 93 | QL_FAIL("BlackVolatilitySurfaceAbsolute: Invalid interpolation type."); |
93 | 94 | } |
94 | 95 | } |
| 96 | + if (flatExtrapolation_) { |
| 97 | + interpolation_[i] = boost::make_shared<FlatExtrapolation>(interpolation_[i]); |
| 98 | + interpolation_[i]->enableExtrapolation(); |
| 99 | + } |
95 | 100 | } |
96 | 101 |
|
97 | 102 | // register with observables |
|
0 commit comments