30 ext::shared_ptr<BlackProcess> process2,
32 : process1_(
std::move(process1)), process2_(
std::move(process2)), rho_(
std::move(correlation)) {
42 "not an European Option");
44 ext::shared_ptr<PlainVanillaPayoff>
payoff =
56 process1_->blackVolatility()->blackVol(exerciseDate,forward1);
58 process2_->blackVolatility()->blackVol(exerciseDate,forward2);
61 process1_->riskFreeRate()->discount(exerciseDate);
66 Real F = forward1/(forward2+strike);
71 + pow((sigma2*(forward2/(forward2+strike))),2)
72 - 2*
rho_->value()*sigma1*sigma2*(forward2/(forward2+strike)));
95 results_.
value = riskFreeDiscount*(NMd2 -
F*NMd1)*(forward2+strike);
99 results_.theta = -((log(riskFreeDiscount)/
t)*callValue
100 + riskFreeDiscount*(forward1*
sigma)/(2*sqrt(
t))*pdf(d1));
Cumulative normal distribution function.
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
SpreadOption::results results_
SpreadOption::arguments arguments_
Shared handle to an observable.
KirkSpreadOptionEngine(ext::shared_ptr< BlackProcess > process1, ext::shared_ptr< BlackProcess > process2, Handle< Quote > correlation)
void calculate() const override
ext::shared_ptr< BlackProcess > process1_
ext::shared_ptr< BlackProcess > process2_
Normal distribution function.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< Exercise > exercise
ext::shared_ptr< Payoff > payoff
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
ext::shared_ptr< QuantLib::Payoff > payoff
Kirk approximation for European spread option on futures.
normal, cumulative and inverse cumulative distributions