258 {
259
260 QL_REQUIRE(
arguments_.barrierLevel == Null<Real>(),
261 "CommodityAveragePriceOptionAnalyticalEngine does not support barrier feature. Use MC engine instead.");
262
263
264 auto& mp =
results_.additionalResults;
271 mp["discount"] = discount;
274
275
277 mp[
"effective_strike"] =
arguments_.effectiveStrike;
279 return;
280 }
281
282
283
285 QL_REQUIRE(effectiveStrike > 0.0, "calculateSpot: expected effectiveStrike to be positive");
286
287
288
292 ::placeholders::_2), effectiveStrike);
293
295 mp["futureVols"] = matchedMoments.futureVols;
296 } else {
297 mp["spotVols"] = matchedMoments.spotVols;
298 }
299
300
302 blackFormula(
arguments_.type, effectiveStrike, matchedMoments.firstMoment(),
303 matchedMoments.stdDev(), discount);
304
305
306
307 mp["effective_strike"] = effectiveStrike;
308 mp["forward"] = matchedMoments.forward;
309 mp["exp_A_2"] = matchedMoments.EA2;
310 mp["tte"] = matchedMoments.timeToExpriy();
311 mp["sigma"] = matchedMoments.sigma;
313 mp["times"] = matchedMoments.times;
314 mp["forwards"] = matchedMoments.forwards;
316}
const Instrument::results * results_
QuantLib::Real rho(const QuantLib::Date &ed_1, const QuantLib::Date &ed_2) const
Return the correlation between two future expiry dates ed_1 and ed_2.
bool isModelDependent() const
QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve_
QuantLib::Handle< QuantLib::BlackVolTermStructure > volStructure_
MomentMatchingResults matchFirstTwoMomentsTurnbullWakeman(const ext::shared_ptr< CommodityIndexedAverageCashFlow > &flow, const ext::shared_ptr< QuantLib::BlackVolTermStructure > &vol, const std::function< double(const QuantLib::Date &expiry1, const QuantLib::Date &expiry2)> &rho, QuantLib::Real strike)
Swap::arguments * arguments_