29 "must be Arithmetic Average::Type");
34 Real accruedAverage = 0;
35 if (pastFixings != 0) {
43 ext::shared_ptr<PlainVanillaPayoff>
payoff =
44 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
48 Real effectiveStrike =
payoff->strike() - accruedAverage;
54 Size m = futureFixings + pastFixings;
55 if (effectiveStrike <= 0.0) {
59 Real S_A_hat = accruedAverage;
61 S_A_hat += (spot *
process_->dividendYield()->discount(fd) /
62 process_->riskFreeRate()->discount(fd)) /
66 results_.delta = discount * (S_A_hat - accruedAverage) / spot;
76 QL_REQUIRE(effectiveStrike > 0.0,
"expected effectiveStrike to be positive");
81 std::vector<Real> forwards;
82 std::vector<Time> times;
83 std::vector<Real> spotVars;
84 std::vector<Real> spotVolsVec;
91 forwards.push_back(spot * dividendDiscount / riskFreeDiscountForFwdEstimation);
92 times.push_back(
process_->blackVolatility()->timeFromReference(fd));
95 process_->blackVolatility()->blackVariance(times.back(), effectiveStrike));
96 spotVolsVec.push_back(std::sqrt(spotVars.back() / times.back()));
98 EA += forwards.back();
104 Size n = forwards.size();
106 for (
Size i = 0; i <
n; ++i) {
107 EA2 += forwards[i] * forwards[i] * exp(spotVars[i]);
108 for (
Size j = 0; j < i; ++j) {
109 EA2 += 2 * forwards[i] * forwards[j] * exp(spotVars[j]);
116 Real tn = times.back();
117 Real sigma = sqrt(log(EA2 / (EA * EA)) / tn);
Black-formula calculator class.
Black 1976 calculator class.
virtual Real delta(Real spot) const
virtual Real gamma(Real spot) const
Average::Type averageType
std::vector< Date > fixingDates
DiscreteAveragingAsianOption::results results_
DiscreteAveragingAsianOption::arguments arguments_
std::map< std::string, ext::any > additionalResults
void calculate() const override
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
#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
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
Turnbull Wakeman moment-matching Asian option Engine.