22#include <ql/pricingengines/blackcalculator.hpp>
26using namespace CrossAssetAnalytics;
29 const QuantLib::ext::shared_ptr<CrossAssetModel>& model,
const Size eqName,
const Size EqCcy)
30 : model_(model), eqIdx_(eqName), ccyIdx_(EqCcy) {}
33 const QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff,
const Real discount,
34 const Real eqForward)
const {
53 BlackCalculator
black(payoff, eqForward, stdev, discount);
60 QL_REQUIRE(
arguments_.exercise->type() == Exercise::European,
"only European options are allowed");
62 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
63 QL_REQUIRE(payoff != NULL,
"only striked payoff is allowed");
66 Time t =
model_->irlgm1f(0)->termStructure()->timeFromReference(expiry);
75 Real divDiscount =
model_->eqbs(
eqIdx_)->equityDivYieldCurveToday()->discount(expiry);
76 Real eqIrDiscount =
model_->eqbs(
eqIdx_)->equityIrCurveToday()->discount(expiry);
77 Real cashflowsDiscount =
model_->irlgm1f(
ccyIdx_)->termStructure()->discount(expiry);
79 Real eqForward =
model_->eqbs(
eqIdx_)->eqSpotToday()->value() * divDiscount / eqIrDiscount;
81 results_.value =
value(0.0, t, payoff, cashflowsDiscount, eqForward);
analytic cross-asset lgm eq option engine
const Instrument::results * results_
Real value(const Time t0, const Time t, const QuantLib::ext::shared_ptr< StrikedTypePayoff > payoff, const Real domesticDiscount, const Real eqForward) const
AnalyticXAssetLgmEquityOptionEngine(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, const Size equityIdx, const Size ccyIdx)
void calculate() const override
const QuantLib::ext::shared_ptr< CrossAssetModel > model_
analytics for the cross asset model
Real integral(const CrossAssetModel &model, const E &e, const Real a, const Real b)
const P2_< E1, E2 > P(const E1 &e1, const E2 &e2)
RandomVariable sqrt(RandomVariable x)
RandomVariable variance(const RandomVariable &r)
RandomVariable black(const RandomVariable &omega, const RandomVariable &t, const RandomVariable &strike, const RandomVariable &forward, const RandomVariable &impliedVol)
Real eval(const CrossAssetModel &x, const Real t) const
Real eval(const CrossAssetModel &x, const Real t) const
Real eval(const CrossAssetModel &x, const Real t) const
Swap::arguments * arguments_