26#ifndef quantlib_interpolated_smile_section_hpp
27#define quantlib_interpolated_smile_section_hpp
39 template<
class Interpolator>
44 std::vector<Rate> strikes,
47 const Interpolator& interpolator = Interpolator(),
52 std::vector<Rate> strikes,
53 const std::vector<Real>& stdDevs,
55 const Interpolator& interpolator = Interpolator(),
60 std::vector<Rate> strikes,
64 const Interpolator& interpolator = Interpolator(),
69 std::vector<Rate> strikes,
70 const std::vector<Real>& stdDevs,
73 const Interpolator& interpolator = Interpolator(),
91 mutable std::vector<Volatility>
vols_;
96 template <
class Interpolator>
99 std::vector<Rate> strikes,
102 const Interpolator& interpolator,
107 exerciseTimeSquareRoot_(
std::sqrt(exerciseTime())), strikes_(
std::move(strikes)),
108 stdDevHandles_(stdDevHandles), atmLevel_(
std::move(atmLevel)), vols_(stdDevHandles.size()) {
118 template <
class Interpolator>
121 std::vector<Rate> strikes,
122 const std::vector<Real>& stdDevs,
124 const Interpolator& interpolator,
129 exerciseTimeSquareRoot_(
std::sqrt(exerciseTime())), strikes_(
std::move(strikes)),
130 stdDevHandles_(stdDevs.size()), vols_(stdDevs.size()) {
133 for (
Size i=0; i<stdDevs.size(); ++i)
144 template <
class Interpolator>
147 std::vector<Rate> strikes,
151 const Interpolator& interpolator,
152 const Date& referenceDate,
156 exerciseTimeSquareRoot_(
std::sqrt(exerciseTime())), strikes_(
std::move(strikes)),
157 stdDevHandles_(stdDevHandles), atmLevel_(
std::move(atmLevel)), vols_(stdDevHandles.size()) {
167 template <
class Interpolator>
170 std::vector<Rate> strikes,
171 const std::vector<Real>& stdDevs,
174 const Interpolator& interpolator,
175 const Date& referenceDate,
179 exerciseTimeSquareRoot_(
std::sqrt(exerciseTime())), strikes_(
std::move(strikes)),
180 stdDevHandles_(stdDevs.size()), vols_(stdDevs.size()) {
183 for (
Size i=0; i<stdDevs.size(); ++i)
195 template <
class Interpolator>
198 for (
Size i=0; i<stdDevHandles_.size(); ++i)
199 vols_[i] = stdDevHandles_[i]->value()/exerciseTimeSquareRoot_;
200 interpolation_.update();
204 template <
class Interpolator>
207 Real v = interpolation_(strike,
true);
208 return v*
v*exerciseTime();
211 template <
class Interpolator>
214 return interpolation_(strike,
true);
217 template <
class Interpolator>
Actual/365 (Fixed) day counter.
Actual/365 (Fixed) day count convention.
Shared handle to an observable.
Real atmLevel() const override
void performCalculations() const override
Handle< Quote > atmLevel_
Real exerciseTimeSquareRoot_
InterpolatedSmileSection(Time expiryTime, std::vector< Rate > strikes, const std::vector< Handle< Quote > > &stdDevHandles, Handle< Quote > atmLevel, const Interpolator &interpolator=Interpolator(), const DayCounter &dc=Actual365Fixed(), VolatilityType type=ShiftedLognormal, Real shift=0.0)
Real minStrike() const override
Interpolation interpolation_
std::vector< Handle< Quote > > stdDevHandles_
Volatility volatilityImpl(Rate strike) const override
Real varianceImpl(Rate strike) const override
std::vector< Volatility > vols_
std::vector< Rate > strikes_
Real maxStrike() const override
base class for 1-D interpolations.
Framework for calculation on demand and result caching.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
market element returning a stored value
interest rate volatility smile section
virtual const Date & referenceDate() const
virtual Rate shift() const
Real Time
continuous quantity with 1-year units
Real Volatility
volatility
std::size_t Size
size of a container
framework for calculation on demand and result caching
linear interpolation between discrete points
ext::shared_ptr< BlackVolTermStructure > v
Smile section base class.
base class for term structures