36 ext::shared_ptr<CoxIngersollRossProcess> cirProcess,
37 ext::shared_ptr<GeneralizedBlackScholesProcess> bsProcess,
44 ext::shared_ptr<FdmQuantoHelper> quantoHelper)
45 : bsProcess_(
std::move(bsProcess)), cirProcess_(
std::move(cirProcess)),
46 quantoHelper_(
std::move(quantoHelper)),
47 tGrid_(tGrid), xGrid_(xGrid), rGrid_(rGrid), dampingSteps_(dampingSteps),
48 rho_(
rho), schemeDesc_(schemeDesc) {}
51 ext::shared_ptr<CoxIngersollRossProcess> cirProcess,
52 ext::shared_ptr<GeneralizedBlackScholesProcess> bsProcess,
60 ext::shared_ptr<FdmQuantoHelper> quantoHelper)
61 : bsProcess_(
std::move(bsProcess)), cirProcess_(
std::move(cirProcess)),
62 quantoHelper_(
std::move(quantoHelper)), dividends_(
std::move(dividends)),
63 tGrid_(tGrid), xGrid_(xGrid), rGrid_(rGrid), dampingSteps_(dampingSteps), rho_(
rho),
64 schemeDesc_(schemeDesc) {}
68 const ext::shared_ptr<StrikedTypePayoff>
payoff =
69 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
70 const Time maturity =
bsProcess_->time(arguments_.exercise->lastDate());
73 const ext::shared_ptr<Fdm1dMesher> shortRateMesher(
77 const ext::shared_ptr<Fdm1dMesher> equityMesher(
81 std::pair<Real, Real>(
payoff->strike(), 0.1),
85 const ext::shared_ptr<FdmMesher> mesher(
89 const ext::shared_ptr<FdmInnerValueCalculator> calculator(
93 const ext::shared_ptr<FdmStepConditionComposite> conditions =
105 calculator, maturity,
112 const ext::shared_ptr<StrikedTypePayoff>
payoff =
113 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
124 results_.value = solver->valueAt(spot, r0);
125 results_.delta = solver->deltaAt(spot, r0);
126 results_.gamma = solver->gammaAt(spot, r0);
127 results_.theta = solver->thetaAt(spot, r0);
131 ext::shared_ptr<CoxIngersollRossProcess> cirProcess,
132 ext::shared_ptr<GeneralizedBlackScholesProcess> bsProcess,
134 : cirProcess_(
std::move(cirProcess)), bsProcess_(
std::move(bsProcess)), rho_(
rho),
138 const ext::shared_ptr<FdmQuantoHelper>& quantoHelper) {
170 schemeDesc_ = ext::make_shared<FdmSchemeDesc>(schemeDesc);
176 const std::vector<Date>& dividendDates,
177 const std::vector<Real>& dividendAmounts) {
182 MakeFdCIRVanillaEngine::operator
183 ext::shared_ptr<PricingEngine>()
const {
184 return ext::make_shared<FdCIRVanillaEngine>(
188 tGrid_, xGrid_, rGrid_, dampingSteps_,
const Instrument::results * results_
FdmSolverDesc getSolverDesc(Real equityScaleFactor) const
ext::shared_ptr< GeneralizedBlackScholesProcess > bsProcess_
FdCIRVanillaEngine(ext::shared_ptr< CoxIngersollRossProcess > cirProcess, ext::shared_ptr< GeneralizedBlackScholesProcess > bsProcess, Size tGrid, Size xGrid, Size vGrid, Size dampingSteps, Real rho, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::ModifiedHundsdorfer(), ext::shared_ptr< FdmQuantoHelper > quantoHelper={})
void calculate() const override
ext::shared_ptr< CoxIngersollRossProcess > cirProcess_
DividendSchedule dividends_
ext::shared_ptr< FdmQuantoHelper > quantoHelper_
const FdmSchemeDesc schemeDesc_
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)
Shared handle to an observable.
MakeFdCIRVanillaEngine & withTGrid(Size tGrid)
MakeFdCIRVanillaEngine & withQuantoHelper(const ext::shared_ptr< FdmQuantoHelper > &quantoHelper)
MakeFdCIRVanillaEngine & withCashDividends(const std::vector< Date > ÷ndDates, const std::vector< Real > ÷ndAmounts)
MakeFdCIRVanillaEngine & withRGrid(Size rGrid)
MakeFdCIRVanillaEngine & withFdmSchemeDesc(const FdmSchemeDesc &schemeDesc)
MakeFdCIRVanillaEngine(ext::shared_ptr< CoxIngersollRossProcess > cirProcess, ext::shared_ptr< GeneralizedBlackScholesProcess > bsProcess, Real rho)
MakeFdCIRVanillaEngine & withXGrid(Size xGrid)
MakeFdCIRVanillaEngine & withDampingSteps(Size dampingSteps)
DividendSchedule dividends_
ext::shared_ptr< FdmQuantoHelper > quantoHelper_
ext::shared_ptr< FdmSchemeDesc > schemeDesc_
template class providing a null value for a given type.
CoxIngersollRoss process.
Finite-differences CIR vanilla option engine.
1-d mesher for the Black-Scholes process (in ln(S))
layer of abstraction to calculate the inner value
memory layout of a fdm linear operator
FdmMesher which is a composite of Fdm1dMesher.
One-dimensional grid mesher.
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
std::vector< ext::shared_ptr< Dividend > > DividendVector(const std::vector< Date > ÷ndDates, const std::vector< Real > ÷nds)
helper function building a sequence of fixed dividends
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet