36 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
41 : process_(
std::move(process)),
42 tGrid_(tGrid), xGrid_(xGrid), dampingSteps_(dampingSteps),
43 schemeDesc_(schemeDesc) {
48 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
54 : process_(
std::move(process)), dividends_(
std::move(dividends)),
55 tGrid_(tGrid), xGrid_(xGrid), dampingSteps_(dampingSteps),
56 schemeDesc_(schemeDesc) {
62 const Date exerciseDate = arguments_.exercise->lastDate();
64 const Date settlementDate =
process_->riskFreeRate()->referenceDate();
66 const auto escrowedDividendAdj =
67 ext::make_shared<EscrowedDividendAdjustment>(
71 [&](
Date d){ return process_->time(d); },
74 const Real divAdj = escrowedDividendAdj
75 ->dividendAdjustment(
process_->time(settlementDate));
78 "spot minus dividends becomes negative");
81 ext::dynamic_pointer_cast<PlainVanillaPayoff>(arguments_.payoff);
87 const auto mesher = ext::make_shared<FdmMesherComposite>(
88 ext::make_shared<FdmBlackScholesMesher>(
91 std::pair<Real, Real>(
payoff->strike(), 0.1),
92 emptyDividendSchedule,
93 ext::shared_ptr<FdmQuantoHelper>(),
96 const auto innerValuecalculator =
97 ext::make_shared<FdmShoutLogInnerValueCalculator>(
99 escrowedDividendAdj, maturity,
payoff, mesher, 0);
103 zeroDividendSchedule.push_back(
104 ext::make_shared<FixedDividend>(0.0, cf->date()));
106 const auto conditions =
108 zeroDividendSchedule,
109 arguments_.exercise, mesher,
110 innerValuecalculator,
111 process_->riskFreeRate()->referenceDate(),
112 process_->riskFreeRate()->dayCounter());
116 conditions, innerValuecalculator,
120 ext::make_shared<FdmBlackScholesSolver>(
126 results_.value = solver->valueAt(spot);
127 results_.delta = solver->deltaAt(spot);
128 results_.gamma = solver->gammaAt(spot);
129 results_.theta = solver->thetaAt(spot);
const Instrument::results * results_
void calculate() const override
const ext::shared_ptr< GeneralizedBlackScholesProcess > process_
DividendSchedule dividends_
FdBlackScholesShoutEngine(ext::shared_ptr< GeneralizedBlackScholesProcess >, Size tGrid=100, Size xGrid=100, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Douglas())
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.
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
Option exercise classes and payoff function.
Finite-Differences Black Scholes shout option engine.
1-d mesher for the Black-Scholes process (in ln(S))
FdmMesher which is a composite of Fdm1dMesher.
inner value for a shout option
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