39 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
43 : process_(
std::move(process)), tGrid_(tGrid), xGrid_(xGrid), schemeDesc_(schemeDesc) {}
47 "Bermudan exercise supported only");
50 const ext::shared_ptr<StrikedTypePayoff>
payoff =
55 const ext::shared_ptr<Fdm1dMesher> equityMesher(
57 maturity,
payoff->strike()));
59 const ext::shared_ptr<Fdm1dMesher> exerciseMesher(
64 const ext::shared_ptr<FdmMesher> mesher (
68 ext::shared_ptr<FdmInnerValueCalculator> calculator(
72 std::list<ext::shared_ptr<StepCondition<Array> > > stepConditions;
73 std::list<std::vector<Time> > stoppingTimes;
76 std::vector<Time> exerciseTimes;
79 QL_REQUIRE(
t >= 0,
"exercise dates must not contain past date");
80 exerciseTimes.push_back(
t);
82 stoppingTimes.push_back(exerciseTimes);
84 ext::shared_ptr<FdmInnerValueCalculator> exerciseCalculator(
89 exerciseTimes, mesher, exerciseCalculator,
92 ext::shared_ptr<FdmStepConditionComposite> conditions(
100 calculator, maturity,
tGrid_, 0 };
101 ext::shared_ptr<FdmSimple2dBSSolver> solver(
109 results_.delta = solver->deltaAt(spot, 1, spot*0.01);
110 results_.gamma = solver->gammaAt(spot, 1, spot*0.01);
111 results_.theta = solver->thetaAt(spot, 1);
FdSimpleBSSwingEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > p, Size tGrid=50, Size xGrid=100, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Douglas())
void calculate() const override
const ext::shared_ptr< GeneralizedBlackScholesProcess > process_
const FdmSchemeDesc schemeDesc_
VanillaSwingOption::results results_
VanillaSwingOption::arguments arguments_
Shared handle to an observable.
condition to be applied at every time step
ext::shared_ptr< SwingExercise > exercise
ext::shared_ptr< StrikedTypePayoff > payoff
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
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.
simple swing step condition
composite of fdm step conditions
Finite Differences Black-Scholes engine for simple swing options.
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