22#include <ql/pricingengines/blackcalculator.hpp>
26using namespace CrossAssetAnalytics;
29 const Size foreignCurrency)
30 : model_(model), foreignCurrency_(foreignCurrency), cacheEnabled_(false), cacheDirty_(true) {}
33 const Real domesticDiscount,
const Real fxForward)
const {
70 BlackCalculator
black(payoff, fxForward, std::sqrt(
variance), domesticDiscount);
77 QL_REQUIRE(
arguments_.exercise->type() == Exercise::European,
"only European options are allowed");
79 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
80 QL_REQUIRE(payoff != NULL,
"only striked payoff is allowed");
83 Time t =
model_->irlgm1f(0)->termStructure()->timeFromReference(expiry);
93 Real domesticDiscount =
model_->irlgm1f(0)->termStructure()->discount(expiry);
95 Real fxForward =
model_->fxbs(
foreignCurrency_)->fxSpotToday()->value() * foreignDiscount / domesticDiscount;
97 results_.value =
value(0.0, t, payoff, domesticDiscount, fxForward);
analytic cc lgm fx option engine
const Instrument::results * results_
AnalyticCcLgmFxOptionEngine(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, const Size foreignCurrency)
Real value(const Time t0, const Time t, const QuantLib::ext::shared_ptr< StrikedTypePayoff > payoff, const Real domesticDiscount, const Real fxForward) const
void calculate() const override
const QuantLib::ext::shared_ptr< CrossAssetModel > model_
const Size foreignCurrency_
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)
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
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_