34 class integrand_vasicek {
45 Real g = g_k(T_ - u, kappa_);
53 ext::shared_ptr<GeneralizedBlackScholesProcess> blackProcess,
54 ext::shared_ptr<Vasicek> vasicekProcess,
56 : blackProcess_(
std::move(blackProcess)), vasicekProcess_(
std::move(vasicekProcess)),
64 "not an European option");
66 ext::shared_ptr<StrikedTypePayoff>
payoff =
67 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
74 Real T =
blackProcess_->riskFreeRate()->dayCounter().yearFraction(
blackProcess_->riskFreeRate().currentLink()->referenceDate(),arguments_.exercise->lastDate());
85 Real d_positive = (std::log((S_t / K) / zcb) + upsilon / 2) / std::sqrt(upsilon);
86 Real d_negative = (std::log((S_t / K) / zcb) - upsilon / 2) / std::sqrt(upsilon);
87 Real n_d1 =
f(epsilon * d_positive);
88 Real n_d2 =
f(epsilon * d_negative);
90 results_.value = epsilon * ((S_t * n_d1) - (zcb * K * n_d2));
const Instrument::results * results_
ext::shared_ptr< Vasicek > vasicekProcess_
void calculate() const override
ext::shared_ptr< GeneralizedBlackScholesProcess > blackProcess_
AnalyticBlackVasicekEngine(ext::shared_ptr< GeneralizedBlackScholesProcess >, ext::shared_ptr< Vasicek >, Real correlation)
Cumulative normal distribution function.
Integral of a one-dimensional function.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
ext::shared_ptr< QuantLib::Payoff > payoff
normal, cumulative and inverse cumulative distributions
integral of a one-dimensional function using Simpson formula