Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
mcmultilegoptionengine.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
20
21namespace QuantExt {
22
24 const Handle<CrossAssetModel>& model, const SequenceType calibrationPathGenerator,
25 const SequenceType pricingPathGenerator, const Size calibrationSamples, const Size pricingSamples,
26 const Size calibrationSeed, const Size pricingSeed, const Size polynomOrder,
27 const LsmBasisSystem::PolynomialType polynomType, const SobolBrownianGenerator::Ordering ordering,
28 const SobolRsg::DirectionIntegers directionIntegers, const std::vector<Handle<YieldTermStructure>>& discountCurves,
29 const std::vector<Date>& simulationDates, const std::vector<Size>& externalModelIndices, const bool minObsDate,
30 const RegressorModel regressorModel, const Real regressionVarianceCutoff)
31 : McMultiLegBaseEngine(model, calibrationPathGenerator, pricingPathGenerator, calibrationSamples, pricingSamples,
32 calibrationSeed, pricingSeed, polynomOrder, polynomType, ordering, directionIntegers,
33 discountCurves, simulationDates, externalModelIndices, minObsDate, regressorModel,
34 regressionVarianceCutoff) {
35 registerWith(model_);
36 for (auto& h : discountCurves_) {
37 registerWith(h);
38 }
39}
40
42 const QuantLib::ext::shared_ptr<LinearGaussMarkovModel>& model, const SequenceType calibrationPathGenerator,
43 const SequenceType pricingPathGenerator, const Size calibrationSamples, const Size pricingSamples,
44 const Size calibrationSeed, const Size pricingSeed, const Size polynomOrder,
45 const LsmBasisSystem::PolynomialType polynomType, const SobolBrownianGenerator::Ordering ordering,
46 const SobolRsg::DirectionIntegers directionIntegers, const Handle<YieldTermStructure>& discountCurve,
47 const std::vector<Date>& simulationDates, const std::vector<Size>& externalModelIndices, const bool minimalObsDate,
48 const RegressorModel regressorModel, const Real regressionVarianceCutoff)
50 std::vector<QuantLib::ext::shared_ptr<IrModel>>(1, model),
51 std::vector<QuantLib::ext::shared_ptr<FxBsParametrization>>())),
52 calibrationPathGenerator, pricingPathGenerator, calibrationSamples, pricingSamples,
53 calibrationSeed, pricingSeed, polynomOrder, polynomType, ordering, directionIntegers,
54 {discountCurve}, simulationDates, externalModelIndices, minimalObsDate, regressorModel,
55 regressionVarianceCutoff) {}
56
58
59 leg_ = arguments_.legs;
60 currency_ = arguments_.currency;
61 payer_ = arguments_.payer;
62 exercise_ = arguments_.exercise;
63 optionSettlement_ = arguments_.settlementType;
64
66
67 // convert base ccy result from McMultiLegbaseEngine to desired npv currency
68 Real fxSpot = 1.0;
69 Size npvCcyIndex = model_->ccyIndex(currency_.front());
70 if (npvCcyIndex > 0)
71 fxSpot = model_->fxbs(npvCcyIndex - 1)->fxSpotToday()->value();
72 results_.value = resultValue_ / fxSpot;
73 results_.additionalResults["underlyingNpv"] = resultUnderlyingNpv_ / fxSpot;
74 results_.additionalResults["amcCalculator"] = amcCalculator();
75} // calculate
76
77} // namespace QuantExt
const Instrument::results * results_
Definition: cdsoption.cpp:81
FX Black Scholes parametrizations.
QuantLib::ext::shared_ptr< Exercise > exercise_
std::vector< Handle< YieldTermStructure > > discountCurves_
Handle< CrossAssetModel > model_
QuantLib::ext::shared_ptr< AmcCalculator > amcCalculator() const
McMultiLegOptionEngine(const Handle< CrossAssetModel > &model, 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 >())
MC engine for multi leg option instrument.
Swap::arguments * arguments_