26 ext::shared_ptr<GeneralizedBlackScholesProcess> process1,
27 ext::shared_ptr<GeneralizedBlackScholesProcess> process2,
29 : process1_(
std::move(process1)),
30 process2_(
std::move(process2)),
37 const ext::shared_ptr<EuropeanExercise> exercise =
39 QL_REQUIRE(exercise,
"not an European exercise");
41 const ext::shared_ptr<SpreadBasketPayoff> spreadPayoff =
43 QL_REQUIRE(spreadPayoff,
" spread payoff expected");
45 const ext::shared_ptr<PlainVanillaPayoff>
payoff =
46 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
47 spreadPayoff->basePayoff());
53 const Date maturityDate = exercise->lastDate();
55 /
process1_->riskFreeRate()->discount(maturityDate)
56 *
process1_->dividendYield()->discount(maturityDate);
59 /
process2_->riskFreeRate()->discount(maturityDate)
60 *
process2_->dividendYield()->discount(maturityDate);
62 const Real variance1 =
63 process1_->blackVolatility()->blackVariance(maturityDate, f1);
64 const Real variance2 =
65 process2_->blackVolatility()->blackVariance(maturityDate, f2);
68 process1_->riskFreeRate()->discount(exercise->lastDate());
BasketOption::results results_
BasketOption::arguments arguments_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< Exercise > exercise
ext::shared_ptr< Payoff > payoff
const ext::shared_ptr< GeneralizedBlackScholesProcess > process1_
void calculate() const override
SpreadBlackScholesVanillaEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process1, ext::shared_ptr< GeneralizedBlackScholesProcess > process2, Real correlation)
const ext::shared_ptr< GeneralizedBlackScholesProcess > process2_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
Real DiscountFactor
discount factor between dates
ext::shared_ptr< QuantLib::Payoff > payoff
base class for 2d spread pricing engines using the Black-Scholes model.