21#include <ql/cashflows/simplecashflow.hpp>
28 const Handle<CrossAssetModel>& model,
const Currency& domesticCcy,
const Currency& foreignCcy,
30 const Size calibrationSamples,
const Size pricingSamples,
const Size calibrationSeed,
const Size pricingSeed,
31 const Size polynomOrder,
const LsmBasisSystem::PolynomialType polynomType,
32 const SobolBrownianGenerator::Ordering ordering,
const SobolRsg::DirectionIntegers directionIntegers,
33 const std::vector<Handle<YieldTermStructure>>& discountCurves,
const std::vector<Date>& simulationDates,
34 const std::vector<Size>& externalModelIndices,
const bool minimalObsDate,
const RegressorModel regressorModel,
35 const Real regressionVarianceCutoff)
36 :
McMultiLegBaseEngine(model, calibrationPathGenerator, pricingPathGenerator, calibrationSamples, pricingSamples,
37 calibrationSeed, pricingSeed, polynomOrder, polynomType, ordering, directionIntegers,
38 discountCurves, simulationDates, externalModelIndices, minimalObsDate, regressorModel,
39 regressionVarianceCutoff),
40 domesticCcy_(domesticCcy), foreignCcy_(foreignCcy), npvCcy_(npvCcy) {
42 for (
auto const& h : discountCurves)
48 auto payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
49 QL_REQUIRE(payoff,
"McCamFxOptionEngine: non-striked payoff given");
50 QL_REQUIRE(
arguments_.exercise->type() == Exercise::European,
"McCamFxOptionEngine: not an European option");
51 QL_REQUIRE(!
arguments_.exercise->dates().empty(),
"McCamFxOptionEngine: exercise dates are empty");
53 Date payDate =
arguments_.exercise->dates().front() + 1;
55 Real w = payoff->optionType() == Option::Call ? 1.0 : -1.0;
56 Leg domesticLeg{QuantLib::ext::make_shared<SimpleCashFlow>(-w * payoff->strike(), payDate)};
57 Leg foreignLeg{QuantLib::ext::make_shared<SimpleCashFlow>(w, payDate)};
59 leg_ = {domesticLeg, foreignLeg};
71 fxSpot =
model_->fxbs(npvCcyIndex - 1)->fxSpotToday()->value();
const Instrument::results * results_
McCamFxOptionEngine(const Handle< CrossAssetModel > &model, const Currency &domesticCcy, const Currency &foreignCcy, const Currency &npvCcy, const SequenceType calibrationPathGenerator, const SequenceType pricingPathGenerator, const Size calibrationSamples, const Size pricingSamples, const Size calibrationSeed, const Size pricingSeed, const Size polynomOrder, const LsmBasisSystem::PolynomialType polynomType, const SobolBrownianGenerator::Ordering ordering=SobolBrownianGenerator::Steps, const SobolRsg::DirectionIntegers directionIntegers=SobolRsg::JoeKuoD7, const std::vector< Handle< YieldTermStructure > > &discountCurves=std::vector< Handle< YieldTermStructure > >(), const std::vector< Date > &simulationDates=std::vector< Date >(), const std::vector< Size > &externalModelIndices=std::vector< Size >(), const bool minimalObsDate=true, const RegressorModel regressorModel=RegressorModel::Simple, const Real regressionVarianceCutoff=Null< Real >())
void calculate() const override
const Currency domesticCcy_
const Currency foreignCcy_
Settlement::Type optionSettlement_
std::vector< Currency > currency_
QuantLib::ext::shared_ptr< Exercise > exercise_
Real resultUnderlyingNpv_
Handle< CrossAssetModel > model_
QuantLib::ext::shared_ptr< AmcCalculator > amcCalculator() const
std::vector< bool > payer_
MC CAM engine for FX Option instrument.
Swap::arguments * arguments_