36 const ext::shared_ptr<HestonModel>& model,
42 ext::shared_ptr<LocalVolTermStructure> leverageFct,
43 const Real mixingFactor)
46 tGrid_(tGrid), xGrid_(xGrid), vGrid_(vGrid), dampingSteps_(dampingSteps),
47 schemeDesc_(schemeDesc), leverageFct_(
std::move(leverageFct)), mixingFactor_(mixingFactor) {}
52 "only Knock-Out double barrier options are supported");
55 const ext::shared_ptr<HestonProcess>& process =
model_->process();
56 const Time maturity = process->time(
arguments_.exercise->lastDate());
59 const Size tGridMin = 5;
60 const Size tGridAvgSteps = std::max(tGridMin,
tGrid_/50);
62 const ext::shared_ptr<FdmHestonLocalVolatilityVarianceMesher> vMesher
63 = ext::make_shared<FdmHestonLocalVolatilityVarianceMesher>(
67 const ext::shared_ptr<StrikedTypePayoff>
payoff =
68 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
73 const ext::shared_ptr<Fdm1dMesher> equityMesher(
77 process->s0(), process->dividendYield(),
78 process->riskFreeRate(), vMesher->volaEstimate()),
79 maturity,
payoff->strike(), xMin, xMax));
81 const ext::shared_ptr<FdmMesher> mesher (
85 const ext::shared_ptr<FdmInnerValueCalculator> calculator(
89 std::list<ext::shared_ptr<StepCondition<Array> > > stepConditions;
90 std::list<std::vector<Time> > stoppingTimes;
93 "only european style option are supported");
95 ext::shared_ptr<FdmStepConditionComposite> conditions(
100 boundaries.push_back(FdmBoundaryConditionSet::value_type(
104 boundaries.push_back(FdmBoundaryConditionSet::value_type(
110 calculator, maturity,
117 const Real spot = process->s0()->value();
118 results_.value = solver->valueAt(spot, process->v0());
119 results_.delta = solver->deltaAt(spot, process->v0());
120 results_.gamma = solver->gammaAt(spot, process->v0());
121 results_.theta = solver->thetaAt(spot, process->v0());
Double Barrier option on a single asset.
void calculate() const override
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
FdHestonDoubleBarrierEngine(const ext::shared_ptr< HestonModel > &model, Size tGrid=100, Size xGrid=100, Size vGrid=50, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer(), ext::shared_ptr< LocalVolTermStructure > leverageFct=ext::shared_ptr< LocalVolTermStructure >(), Real mixingFactor=1.0)
const FdmSchemeDesc schemeDesc_
static ext::shared_ptr< GeneralizedBlackScholesProcess > processHelper(const Handle< Quote > &s0, const Handle< YieldTermStructure > &rTS, const Handle< YieldTermStructure > &qTS, Volatility vol)
Base class for some pricing engine on a particular model.
Handle< HestonModel > model_
Shared handle to an observable.
Heston model for the stochastic volatility of an asset.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Finite-Differences Heston double barrier option engine.
Finite-differences Heston barrier-option rebate helper engine.
Finite-differences Heston vanilla option engine.
1-d mesher for the Black-Scholes process (in ln(S))
Dirichlet boundary conditions for differential operators.
dividend handler for fdm method for one equity direction
One-dimensional grid mesher for the variance part of the Heston model.
layer of abstraction to calculate the inner value
memory layout of a fdm linear operator
FdmMesher which is a composite of Fdm1dMesher.
composite of fdm step conditions
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet