35 Integrand(ext::shared_ptr<StrikedTypePayoff>
payoff,
38 Real riskFreeDiscount,
39 Real dividendDiscount,
45 omega_ = std::log(1.0 - theta_ * nu_ - (sigma_ * sigma_ * nu_) / 2.0) /
nu_;
49 gammaDenom_ = std::exp(gf.logValue(t_ / nu_)) * std::pow(nu_, t_ / nu_);
54 Real s0_adj =
s0_ * std::exp(theta_ * x + omega_ * t_ + (sigma_ * sigma_ * x) / 2.0);
56 vol_adj *= std::sqrt(t_);
58 BlackScholesCalculator bs(payoff_, s0_adj, dividendDiscount_, vol_adj, riskFreeDiscount_);
59 Real bsprice = bs.value();
62 Real gamp = (std::pow(x, t_ / nu_ - 1.0) * std::exp(-x / nu_)) / gammaDenom_;
63 Real result = bsprice * gamp;
68 ext::shared_ptr<StrikedTypePayoff>
payoff_;
84 : process_(
std::move(process)), absErr_(absoluteError) {
92 "not an European Option");
94 ext::shared_ptr<StrikedTypePayoff>
payoff =
110 t, riskFreeDiscount, dividendDiscount,
115 Real val =
f(infinity);
116 while (std::abs(val)>target){
123 Real pvA = integrator1(
f, 0, split);
125 Real pvB = integrator2(
f, split, infinity);
Analytic Variance Gamma option engine for vanilla options.
Black-Scholes formula calculator class.
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Integral of a 1-dimensional function using the Gauss-Kronrod methods.
Integral of a one-dimensional function.
OneAssetOption::results results_
OneAssetOption::arguments arguments_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< Exercise > exercise
ext::shared_ptr< Payoff > payoff
ext::shared_ptr< VarianceGammaProcess > process_
VarianceGammaEngine(ext::shared_ptr< VarianceGammaProcess >, Real absoluteError=1e-5)
void calculate() const override
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
const ext::shared_ptr< Payoff > payoff_
integral of a one-dimensional function using the adaptive Gauss-Lobatto integral
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
ext::shared_ptr< QuantLib::Payoff > payoff
Integral of a 1-dimensional function using the Gauss-Kronrod method.
Integral of a one-dimensional function using segment algorithm.