Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
McCamCurrencySwapEngine Class Reference

#include <qle/pricingengines/mccamcurrencyswapengine.hpp>

+ Inheritance diagram for McCamCurrencySwapEngine:
+ Collaboration diagram for McCamCurrencySwapEngine:

Public Member Functions

 McCamCurrencySwapEngine (const Handle< CrossAssetModel > &model, const std::vector< Currency > &currencies, 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 Handle< CrossAssetModel > & model () const
 

Private Attributes

const std::vector< Currency > currencies_
 
const Currency npvCcy_
 

Additional Inherited Members

- Public Types inherited from McMultiLegBaseEngine
enum  RegressorModel { Simple , LaggedFX }
 
- Protected Member Functions inherited from McMultiLegBaseEngine
 McMultiLegBaseEngine (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, const SobolRsg::DirectionIntegers directionIntegers, 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
 
QuantLib::ext::shared_ptr< AmcCalculatoramcCalculator () const
 
- Protected Attributes inherited from McMultiLegBaseEngine
std::vector< Leg > leg_
 
std::vector< Currency > currency_
 
std::vector< boolpayer_
 
QuantLib::ext::shared_ptr< Exercise > exercise_
 
Settlement::Type optionSettlement_ = Settlement::Physical
 
bool includeSettlementDateFlows_ = false
 
Handle< CrossAssetModelmodel_
 
SequenceType calibrationPathGenerator_
 
SequenceType pricingPathGenerator_
 
Size calibrationSamples_
 
Size pricingSamples_
 
Size calibrationSeed_
 
Size pricingSeed_
 
Size polynomOrder_
 
LsmBasisSystem::PolynomialType polynomType_
 
SobolBrownianGenerator::Ordering ordering_
 
SobolRsg::DirectionIntegers directionIntegers_
 
std::vector< Handle< YieldTermStructure > > discountCurves_
 
std::vector< Date > simulationDates_
 
std::vector< Size > externalModelIndices_
 
bool minimalObsDate_
 
RegressorModel regressorModel_
 
Real regressionVarianceCutoff_
 
QuantLib::ext::shared_ptr< AmcCalculatoramcCalculator_
 
Real resultUnderlyingNpv_
 
Real resultValue_
 

Detailed Description

Definition at line 33 of file mccamcurrencyswapengine.hpp.

Constructor & Destructor Documentation

◆ McCamCurrencySwapEngine()

McCamCurrencySwapEngine ( const Handle< CrossAssetModel > &  model,
const std::vector< Currency > &  currencies,
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>() 
)

Definition at line 25 of file mccamcurrencyswapengine.cpp.

33 : McMultiLegBaseEngine(model, calibrationPathGenerator, pricingPathGenerator, calibrationSamples, pricingSamples,
34 calibrationSeed, pricingSeed, polynomOrder, polynomType, ordering, directionIntegers,
35 discountCurves, simulationDates, externalModelIndices, minimalObsDate, regressorModel,
36 regressionVarianceCutoff),
37 currencies_(currencies), npvCcy_(npvCcy) {
38 registerWith(model_);
39 for (auto const& h : discountCurves)
40 registerWith(h);
41}
const Handle< CrossAssetModel > & model() const
const std::vector< Currency > currencies_
McMultiLegBaseEngine(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, const SobolRsg::DirectionIntegers directionIntegers, 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 >())
Handle< CrossAssetModel > model_

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 43 of file mccamcurrencyswapengine.cpp.

43 {
44
45 leg_ = arguments_.legs;
46 currency_ = arguments_.currency;
47 payer_.resize(arguments_.payer.size());
48 for (Size i = 0; i < arguments_.payer.size(); ++i) {
49 payer_[i] = QuantLib::close_enough(arguments_.payer[i], -1.0);
50 }
51 exercise_ = nullptr;
52
54
55 // convert base ccy result from McMultiLegbaseEngine to desired npv currency
56 Real fxSpot = 1.0;
57 Size npvCcyIndex = model_->ccyIndex(npvCcy_);
58 if (npvCcyIndex > 0)
59 fxSpot = model_->fxbs(npvCcyIndex - 1)->fxSpotToday()->value();
60 results_.value = resultValue_ / fxSpot;
61 results_.additionalResults["amcCalculator"] = amcCalculator();
62} // calculate
const Instrument::results * results_
Definition: cdsoption.cpp:81
QuantLib::ext::shared_ptr< Exercise > exercise_
QuantLib::ext::shared_ptr< AmcCalculator > amcCalculator() const
Swap::arguments * arguments_
+ Here is the call graph for this function:

◆ model()

const Handle< CrossAssetModel > & model ( ) const

Definition at line 49 of file mccamcurrencyswapengine.hpp.

49{ return model_; }

Member Data Documentation

◆ currencies_

const std::vector<Currency> currencies_
private

Definition at line 52 of file mccamcurrencyswapengine.hpp.

◆ npvCcy_

const Currency npvCcy_
private

Definition at line 53 of file mccamcurrencyswapengine.hpp.