20#include <ql/exercise.hpp>
21#include <ql/experimental/exoticoptions/kirkspreadoptionengine.hpp>
22#include <ql/math/distributions/normaldistribution.hpp>
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 =
46 QL_REQUIRE(payoff,
"not a plain-vanilla payoff");
56 process1_->blackVolatility()->blackVol(exerciseDate,forward1);
58 process2_->blackVolatility()->blackVol(exerciseDate,forward2);
61 process1_->riskFreeRate()->discount(exerciseDate);
63 Real strike = payoff->strike();
66 Real F = forward1/(forward2+strike);
71 + pow((sigma2*(forward2/(forward2+strike))),2)
72 - 2*
rho_->value()*sigma1*sigma2*(forward2/(forward2+strike)));
80 Real d1 = (log(F)+ 0.5*pow(sigma,2)*t) / (sigma*sqrt(t));
81 Real d2 = d1 - sigma*sqrt(t);
93 results_.
value = riskFreeDiscount*(F*Nd1-Nd2)*(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
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates