30 const Currency& domCcy) {
32 QL_REQUIRE(domCcy != forCcy,
"CamAmcFxForwardEngineBuilder: domCcy = forCcy = " << domCcy.code());
34 std::vector<Size> externalModelIndices;
35 std::vector<Handle<YieldTermStructure>> discountCurves;
36 std::vector<Size> cIdx;
37 std::vector<QuantLib::ext::shared_ptr<IrModel>> lgm;
38 std::vector<QuantLib::ext::shared_ptr<FxBsParametrization>> fx;
44 for (Size i = 0; i <
cam_->components(CrossAssetModel::AssetType::IR); ++i) {
45 if (i == 0 ||
cam_->irlgm1f(i)->currency() == domCcy ||
cam_->irlgm1f(i)->currency() == forCcy) {
46 lgm.push_back(
cam_->lgm(i));
47 externalModelIndices.push_back(
cam_->pIdx(CrossAssetModel::AssetType::IR, i));
48 cIdx.push_back(
cam_->cIdx(CrossAssetModel::AssetType::IR, i));
50 fx.push_back(
cam_->fxbs(i - 1));
51 externalModelIndices.push_back(
cam_->pIdx(CrossAssetModel::AssetType::FX, i - 1));
52 cIdx.push_back(
cam_->cIdx(CrossAssetModel::AssetType::FX, i - 1));
57 std::sort(externalModelIndices.begin(), externalModelIndices.end());
58 std::sort(cIdx.begin(), cIdx.end());
61 Matrix corr(cIdx.size(), cIdx.size(), 1.0);
62 for (Size i = 0; i < cIdx.size(); ++i) {
63 for (Size j = 0; j < i; ++j) {
64 corr(i, j) = corr(j, i) =
cam_->correlation()(cIdx[i], cIdx[j]);
67 Handle<CrossAssetModel>
model(QuantLib::ext::make_shared<CrossAssetModel>(lgm, fx, corr));
74 auto engine = QuantLib::ext::make_shared<McCamFxForwardEngine>(
Engine builder for FX Forwards.
const std::vector< Date > simulationDates_
virtual QuantLib::ext::shared_ptr< PricingEngine > engineImpl(const Currency &forCcy, const Currency &domCcy) override
const QuantLib::ext::shared_ptr< QuantExt::CrossAssetModel > cam_
const string & engine() const
Return the engine name.
const string & model() const
Return the model name.
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
SequenceType parseSequenceType(const std::string &s)
Convert string to sequence type.
QuantLib::LsmBasisSystem::PolynomialType parsePolynomType(const std::string &s)
Convert text to QuantLib::LsmBasisSystem::PolynomialType.
bool parseBool(const string &s)
Convert text to bool.
SobolRsg::DirectionIntegers parseSobolRsgDirectionIntegers(const std::string &s)
Convert text to QuantLib::SobolRsg::DirectionIntegers.
Real parseRealOrNull(const string &s)
Convert text to Real, empty string to Null<Real>()
QuantExt::McMultiLegBaseEngine::RegressorModel parseRegressorModel(const std::string &s)
Convert text to QuantExt::McMultiLegBaseEngine::RegressorModel.
SobolBrownianGenerator::Ordering parseSobolBrownianGeneratorOrdering(const std::string &s)
Convert text to QuantLib::SobolBrownianGenerator::Ordering.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Serializable Credit Default Swap.