43 ext::shared_ptr<LocalVolTermStructure> leverageFct,
44 const Real mixingFactor)
48 tGrid_(tGrid), xGrid_(xGrid), vGrid_(vGrid), dampingSteps_(dampingSteps),
49 schemeDesc_(schemeDesc), leverageFct_(
std::move(leverageFct)), mixingFactor_(mixingFactor) {}
58 ext::shared_ptr<LocalVolTermStructure> leverageFct,
59 const Real mixingFactor)
63 dividends_(
std::move(dividends)),
64 tGrid_(tGrid), xGrid_(xGrid), vGrid_(vGrid), dampingSteps_(dampingSteps),
65 schemeDesc_(schemeDesc), leverageFct_(
std::move(leverageFct)), mixingFactor_(mixingFactor) {}
72 const ext::shared_ptr<HestonProcess>& process =
model_->process();
73 const Time maturity = process->time(
arguments_.exercise->lastDate());
76 const Size tGridMin = 5;
77 const Size tGridAvgSteps = std::max(tGridMin,
tGrid_/50);
79 const ext::shared_ptr<FdmHestonLocalVolatilityVarianceMesher> vMesher
80 = ext::make_shared<FdmHestonLocalVolatilityVarianceMesher>(
84 const ext::shared_ptr<StrikedTypePayoff>
payoff =
85 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
98 const ext::shared_ptr<Fdm1dMesher> equityMesher(
102 process->s0(), process->dividendYield(),
103 process->riskFreeRate(), vMesher->volaEstimate()),
104 maturity,
payoff->strike(),
105 xMin, xMax, 0.0001, 1.5,
109 const ext::shared_ptr<FdmMesher> mesher (
113 const ext::shared_ptr<StrikedTypePayoff> rebatePayoff(
115 const ext::shared_ptr<FdmInnerValueCalculator> calculator(
120 "only european style option are supported");
122 const ext::shared_ptr<FdmStepConditionComposite> conditions =
126 process->riskFreeRate()->referenceDate(),
127 process->riskFreeRate()->dayCounter());
133 boundaries.push_back(FdmBoundaryConditionSet::value_type(
140 boundaries.push_back(FdmBoundaryConditionSet::value_type(
147 calculator, maturity,
154 const Real spot = process->s0()->value();
155 results_.value = solver->valueAt(spot, process->v0());
156 results_.delta = solver->deltaAt(spot, process->v0());
157 results_.gamma = solver->gammaAt(spot, process->v0());
158 results_.theta = solver->thetaAt(spot, process->v0());
Barrier option on a single asset.
Binary cash-or-nothing payoff.
FdHestonRebateEngine(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={}, Real mixingFactor=1.0)
void calculate() const override
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
DividendSchedule dividends_
const FdmSchemeDesc schemeDesc_
static ext::shared_ptr< GeneralizedBlackScholesProcess > processHelper(const Handle< Quote > &s0, const Handle< YieldTermStructure > &rTS, const Handle< YieldTermStructure > &qTS, Volatility vol)
static ext::shared_ptr< FdmStepConditionComposite > vanillaComposite(const DividendSchedule &schedule, const ext::shared_ptr< Exercise > &exercise, const ext::shared_ptr< FdmMesher > &mesher, const ext::shared_ptr< FdmInnerValueCalculator > &calculator, const Date &refDate, const DayCounter &dayCounter)
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.
template class providing a null value for a given type.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Finite-differences Heston barrier-option rebate helper engine.
1-d mesher for the Black-Scholes process (in ln(S))
Dirichlet boundary conditions for differential operators.
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
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
#define QL_DEPRECATED_DISABLE_WARNING
#define QL_DEPRECATED_ENABLE_WARNING