34#ifndef quantlib_kahale_smile_section_hpp
35#define quantlib_kahale_smile_section_hpp
41#include <boost/math/distributions/normal.hpp>
46#define QL_KAHALE_FMAX QL_MAX_REAL
47#define QL_KAHALE_SMAX 5.0
48#define QL_KAHALE_ACC 1E-12
49#define QL_KAHALE_EPS QL_EPSILON
64 return std::exp(-
a_ * k +
b_);
66 return std::max(
f_ - k, 0.0) +
a_ * k +
b_;
67 boost::math::normal_distribution<Real> normal;
70 return f_ * boost::math::cdf(normal, d1) -
71 k * boost::math::cdf(normal, d2) +
a_ * k +
b_;
81 boost::math::normal_distribution<Real> normal;
82 Real d20 = boost::math::quantile(normal, -
c0p_ + a);
83 Real d21 = boost::math::quantile(normal, -
c1p_ + a);
101 s = std::max(
s, 0.0);
102 boost::math::normal_distribution<Real> normal;
103 Real d20 = boost::math::quantile(normal, -
c0p_);
104 f_ =
k0_ * std::exp(
s * d20 +
s *
s / 2.0);
117 s = std::max(
s, 0.0);
118 boost::math::normal_distribution<Real> normal;
119 Real d21 = boost::math::quantile(normal, -
c1p_);
120 f_ =
k1_ * std::exp(
s * d21 +
s *
s / 2.0);
132 bool interpolate =
false,
133 bool exponentialExtrapolation =
false,
134 bool deleteArbitragePoints =
false,
135 const std::vector<Real>& moneynessGrid = std::vector<Real>(),
137 int forcedLeftIndex = -1,
159 Real discount = 1.0)
const override;
Real atmLevel() const override
Real shift() const override
Time exerciseTime() const override
std::pair< Size, Size > coreIndices() const
const Date & exerciseDate() const override
Real leftCoreStrike() const
const bool exponentialExtrapolation_
const Date & referenceDate() const override
Real minStrike() const override
std::vector< ext::shared_ptr< cFunction > > cFunctions_
Real rightCoreStrike() const
VolatilityType volatilityType() const override
ext::shared_ptr< SmileSectionUtils > ssutils_
ext::shared_ptr< SmileSection > source_
Size index(Rate strike) const
const DayCounter & dayCounter() const override
Real optionPrice(Rate strike, Option::Type type=Option::Call, Real discount=1.0) const override
std::vector< Real > moneynessGrid_
Real maxStrike() const override
Volatility volatilityImpl(Rate strike) const override
template class providing a null value for a given type.
interest rate volatility smile section
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
Real Volatility
volatility
std::size_t Size
size of a container
Smile section base class.
Additional utilities for smile sections.
aHelper(Real k0, Real k1, Real c0, Real c1, Real c0p, Real c1p)
Real operator()(Real a) const
cFunction(Real f, Real s, Real a, Real b)
Real operator()(Real k) const
cFunction(Real a, Real b)
sHelper1(Real k1, Real c0, Real c1, Real c1p)
Real operator()(Real s) const
Real operator()(Real s) const
sHelper(Real k0, Real c0, Real c0p)