22#include <ql/exercise.hpp>
23#include <ql/math/functional.hpp>
24#include <ql/pricingengines/vanilla/analyticcevengine.hpp>
25#include <boost/math/distributions/non_central_chi_squared.hpp>
26#include <boost/math/special_functions/gamma.hpp>
35 delta_((1.0-2.0*beta)/(1.0-beta)),
45 typedef boost::math::non_central_chi_squared_distribution<Real>
48 const Real kTilde =
X(strike);
52 return f0_ * (1.0 - boost::math::cdf(
54 - strike * boost::math::cdf(
59 boost::math::gamma_p(0.5*
delta_-1.0,
x0_/(2.0*t));
61 return f0_ * (g - boost::math::cdf(
63 - strike * boost::math::cdf(
69 return -
f0_ * boost::math::cdf(
71 + strike * (1.0 - boost::math::cdf(
75 return -
f0_ * boost::math::cdf(
77 + strike * (1.0 - boost::math::cdf(
82 QL_FAIL(
"unknown option type");
90 : calculator_(ext::make_shared<
CEVCalculator>(f0, alpha, beta)),
91 discountCurve_(
std::move(discountCurve)) {
98 "not an European option");
100 ext::shared_ptr<StrikedTypePayoff> payoff =
101 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
102 QL_REQUIRE(payoff,
"non-striked payoff given");
104 const Date exerciseDate = arguments_.exercise->lastDate();
107 payoff->optionType(),
const Handle< YieldTermStructure > discountCurve_
void calculate() const override
AnalyticCEVEngine(Real f0, Real alpha, Real beta, Handle< YieldTermStructure > discountCurve)
const ext::shared_ptr< CEVCalculator > calculator_
constant elasticity of variance process (absorbing boundary at f=0)
CEVCalculator(Real f0, Real alpha, Real beta)
Real value(Option::Type optionType, Real strike, Time t) const
Shared handle to an observable.
Real Time
continuous quantity with 1-year units