21#include <ql/methods/finitedifferences/meshers/fdmblackscholesmesher.hpp>
22#include <ql/methods/finitedifferences/meshers/fdmmeshercomposite.hpp>
23#include <ql/methods/finitedifferences/meshers/fdmsimpleprocess1dmesher.hpp>
24#include <ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp>
25#include <ql/methods/finitedifferences/solvers/fdmcirsolver.hpp>
26#include <ql/methods/finitedifferences/stepconditions/fdmstepconditioncomposite.hpp>
27#include <ql/methods/finitedifferences/utilities/fdminnervaluecalculator.hpp>
28#include <ql/pricingengines/vanilla/fdcirvanillaengine.hpp>
29#include <ql/processes/blackscholesprocess.hpp>
30#include <ql/processes/coxingersollrossprocess.hpp>
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)), explicitDividends_(false),
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 explicitDividends_(true),
64 tGrid_(tGrid), xGrid_(xGrid), rGrid_(rGrid), dampingSteps_(dampingSteps), rho_(rho),
65 schemeDesc_(schemeDesc) {}
70 QL_DEPRECATED_DISABLE_WARNING
72 QL_DEPRECATED_ENABLE_WARNING
74 const ext::shared_ptr<StrikedTypePayoff> payoff =
75 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
79 const ext::shared_ptr<Fdm1dMesher> shortRateMesher(
83 const ext::shared_ptr<Fdm1dMesher> equityMesher(
87 std::pair<Real, Real>(payoff->strike(), 0.1),
91 const ext::shared_ptr<FdmMesher> mesher(
95 const ext::shared_ptr<FdmInnerValueCalculator> calculator(
99 const ext::shared_ptr<FdmStepConditionComposite> conditions =
111 calculator, maturity,
118 const ext::shared_ptr<StrikedTypePayoff> payoff =
119 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
125 rho_, payoff->strike()));
131 results_.delta = solver->deltaAt(spot, r0);
132 results_.gamma = solver->gammaAt(spot, r0);
133 results_.theta = solver->thetaAt(spot, r0);
137 ext::shared_ptr<CoxIngersollRossProcess> cirProcess,
138 ext::shared_ptr<GeneralizedBlackScholesProcess> bsProcess,
140 : cirProcess_(
std::move(cirProcess)), bsProcess_(
std::move(bsProcess)), rho_(rho),
144 const ext::shared_ptr<FdmQuantoHelper>& quantoHelper) {
176 schemeDesc_ = ext::make_shared<FdmSchemeDesc>(schemeDesc);
182 const std::vector<Date>& dividendDates,
183 const std::vector<Real>& dividendAmounts) {
189 MakeFdCIRVanillaEngine::operator
190 ext::shared_ptr<PricingEngine>()
const {
191 if (explicitDividends_) {
192 return ext::make_shared<FdCIRVanillaEngine>(
196 tGrid_, xGrid_, rGrid_, dampingSteps_,
201 return ext::make_shared<FdCIRVanillaEngine>(
204 tGrid_, xGrid_, rGrid_, dampingSteps_,
DividendSchedule cashFlow
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)
DividendVanillaOption::results results_
DividendVanillaOption::arguments arguments_
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.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
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