21#include <ql/pricingengines/blackcalculator.hpp>
26 const QuantLib::ext::shared_ptr<CommoditySchwartzModel>& model) : model_(model) {}
30 QL_REQUIRE(
arguments_.exercise->type() == Exercise::European,
"only European options are allowed");
32 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
33 QL_REQUIRE(payoff != NULL,
"only striked payoff is allowed");
35 QuantLib::ext::shared_ptr<CommoditySchwartzParametrization> param =
model_->parametrization();
38 Time T = param->priceCurve()->timeFromReference(expiry);
45 Real forward = param->priceCurve()->price(expiry);
47 Real
variance = param->VtT(0,T) - param->VtT(T,T);
48 BlackCalculator
black(payoff, forward, std::sqrt(
variance), 1.0);
const Instrument::results * results_
CommoditySchwartzFutureOptionEngine(const QuantLib::ext::shared_ptr< CommoditySchwartzModel > &model)
void calculate() const override
QuantLib::ext::shared_ptr< CommoditySchwartzModel > model_
commodity future options priced in the Schwartz model
analytics for the cross asset model
RandomVariable variance(const RandomVariable &r)
RandomVariable black(const RandomVariable &omega, const RandomVariable &t, const RandomVariable &strike, const RandomVariable &forward, const RandomVariable &impliedVol)
Swap::arguments * arguments_